openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #07095
[Merge] lp:~akretion-team/partner-contact-management/partner-firstname-inheritable into lp:partner-contact-management
Alexis de Lattre has proposed merging lp:~akretion-team/partner-contact-management/partner-firstname-inheritable into lp:partner-contact-management.
Requested reviews:
Partner and Contact Core Editors (partner-contact-core-editors)
For more details, see:
https://code.launchpad.net/~akretion-team/partner-contact-management/partner-firstname-inheritable/+merge/222730
This MP is small but very usefull : with the partner_firstname module, the 'name' field on res.partner becomes a fields.function ; this MP make the code of the fields.function inheritable.
--
https://code.launchpad.net/~akretion-team/partner-contact-management/partner-firstname-inheritable/+merge/222730
Your team Partner and Contact Core Editors is requested to review the proposed merge of lp:~akretion-team/partner-contact-management/partner-firstname-inheritable into lp:partner-contact-management.
=== modified file 'partner_firstname/partner.py'
--- partner_firstname/partner.py 2014-02-18 17:09:53 +0000
+++ partner_firstname/partner.py 2014-06-10 20:59:58 +0000
@@ -35,14 +35,19 @@
if cursor.fetchone():
cursor.execute('ALTER TABLE res_partner ALTER COLUMN lastname SET NOT NULL')
+ def _prepare_name_custom(self, cursor, uid, partner, context=None):
+ """
+ This function is designed to be inherited in a custom module
+ """
+ names = (partner.lastname, partner.firstname)
+ fullname = " ".join([s for s in names if s])
+ return fullname
+
def _compute_name_custom(self, cursor, uid, ids, fname, arg, context=None):
res = {}
- partners = self.read(cursor, uid, ids,
- ['firstname', 'lastname'], context=context)
- for rec in partners:
- names = (rec['lastname'], rec['firstname'])
- fullname = " ".join([s for s in names if s])
- res[rec['id']] = fullname
+ for partner in self.browse(cursor, uid, ids, context=context):
+ res[partner.id] = self._prepare_name_custom(
+ cursor, uid, partner, context=context)
return res
def _write_name(self, cursor, uid, partner_id, field_name, field_value, arg, context=None):
Follow ups