From 181696ca9ee557f1e3ed4938d6eed0d3e9feec12 Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Tue, 18 Aug 2015 16:18:36 +0200 Subject: [PATCH] [IMP][partner_firstname] Update documentation according methods refactoring --- partner_firstname/README.rst | 5 +++++ partner_firstname/models.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/partner_firstname/README.rst b/partner_firstname/README.rst index 19a14dc6b..5602d35ee 100644 --- a/partner_firstname/README.rst +++ b/partner_firstname/README.rst @@ -24,6 +24,10 @@ For the same reason, after installing, previous names for contacts will stay in the *name* field, and the first time you edit any of them you will be asked to supply the *last name* and *first name* (just once per contact). +You can use *_get_inverse_name* method to get lastname and firstname from a simple string +and also *_get_computed_name* to get a name form the lastname and firstname. +These methods can be overridden to change the format specified above + For further information, please visit: * https://www.odoo.com/forum/help-1 @@ -39,6 +43,7 @@ Contributors * Olivier Laurent * Hans Henrik Gabelgaard * Jairo Llopis +* Adrien Peiffer Maintainer ---------- diff --git a/partner_firstname/models.py b/partner_firstname/models.py index 159d38700..47f6f7e0f 100644 --- a/partner_firstname/models.py +++ b/partner_firstname/models.py @@ -40,7 +40,9 @@ class ResPartner(models.Model): @api.model def _get_computed_name(self, lastname, firstname): - """Write the 'name' field according to splitted data.""" + """Compute the 'name' field according to splitted data. + You can override this method to change the order of lastname and + firstname the computed name""" return u" ".join((p for p in (lastname, firstname) if p)) @api.one @@ -77,6 +79,8 @@ class ResPartner(models.Model): - Otherwise, make a guess. This method can be easily overriden by other submodules. + You can also override this method to change the order of name's + attributes When this method is called, :attr:`~.name` already has unified and trimmed whitespace.