Browse Source

[IMP][partner_firstname] Update documentation according methods refactoring

14.0
Adrien Peiffer (ACSONE) 9 years ago
committed by Luis Torres
parent
commit
8af36df075
  1. 5
      partner_firstname/README.rst
  2. 6
      partner_firstname/models.py

5
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 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). 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: For further information, please visit:
* https://www.odoo.com/forum/help-1 * https://www.odoo.com/forum/help-1
@ -39,6 +43,7 @@ Contributors
* Olivier Laurent <olivier.laurent@acsone.eu> * Olivier Laurent <olivier.laurent@acsone.eu>
* Hans Henrik Gabelgaard <hhg@gabelgaard.org> * Hans Henrik Gabelgaard <hhg@gabelgaard.org>
* Jairo Llopis <j.llopis@grupoesoc.es> * Jairo Llopis <j.llopis@grupoesoc.es>
* Adrien Peiffer <adrien.peiffer@acsone.eu>
Maintainer Maintainer
---------- ----------

6
partner_firstname/models.py

@ -40,7 +40,9 @@ class ResPartner(models.Model):
@api.model @api.model
def _get_computed_name(self, lastname, firstname): 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)) return u" ".join((p for p in (lastname, firstname) if p))
@api.one @api.one
@ -77,6 +79,8 @@ class ResPartner(models.Model):
- Otherwise, make a guess. - Otherwise, make a guess.
This method can be easily overriden by other submodules. 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 When this method is called, :attr:`~.name` already has unified and
trimmed whitespace. trimmed whitespace.

Loading…
Cancel
Save