← Back to team overview

savoirfairelinux-openerp team mailing list archive

lp:~savoirfairelinux-openerp/partner-contact-management/firstname_lastname_fix_bug_email_improvement into lp:~savoirfairelinux-openerp/partner-contact-management/base_contact_by_functions

 

elhadji.dem@xxxxxxxxxxxxxxxxxxxx has proposed merging lp:~savoirfairelinux-openerp/partner-contact-management/firstname_lastname_fix_bug_email_improvement into lp:~savoirfairelinux-openerp/partner-contact-management/base_contact_by_functions.

Requested reviews:
  Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter)

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/partner-contact-management/firstname_lastname_fix_bug_email_improvement/+merge/202929

[IMP] store full name field in database, remove some methods
-- 
https://code.launchpad.net/~savoirfairelinux-openerp/partner-contact-management/firstname_lastname_fix_bug_email_improvement/+merge/202929
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/partner-contact-management/base_contact_by_functions.
=== modified file 'partner_firstname/partner.py'
--- partner_firstname/partner.py	2014-01-22 20:13:54 +0000
+++ partner_firstname/partner.py	2014-01-23 19:22:00 +0000
@@ -26,9 +26,6 @@
 
     _inherit = 'res.partner'
 
-    def _display_name_compute(self, cr, uid, ids, name, args, context=None):
-        return dict(self.name_get(cr, uid, ids, context=context))
-
     def name_get(self, cr, uid, ids, context=None):
         """ By pass of name_get to use directly firstname and lastname
         as we cannot ensure name as already been computed when calling this
@@ -66,18 +63,10 @@
     def get_full_name(self, cr, uid, ids, field_name, arg, context=None):
         return dict(self.name_get(cr, uid, ids, context=context))
 
-    _display_name_store_triggers = {
-        'res.partner': (lambda self, cr, uid, ids, context=None: self.search(cr, uid, [('id', 'child_of', ids)]),
-                        ['parent_id', 'is_company', 'name', 'firstname'], 10)
-    }
-
-    # indirection to avoid passing a copy of the overridable method when declaring the function field
-    _display_name = lambda self, *args, **kwargs: self._display_name_compute(*args, **kwargs)
-
     _columns = {
-        'full_name': fields.function(_display_name, type='char',
+        'full_name': fields.function(get_full_name, type='char',
                                      string='Full name',
-                                     store=_display_name_store_triggers,
+                                     store=True,
                                      help="First name."),
         'firstname': fields.char("First name", help="First name.")
     }


Follow ups