Partner first name and last name
by Camptocamp https://github.com/OCA/partner-contact , Grupo ESOC Ingeniería de Servicios https://github.com/OCA/partner-contact , Tecnativa https://github.com/OCA/partner-contact , LasLabs https://github.com/OCA/partner-contact , ACSONE SA/NV https://github.com/OCA/partner-contact , DynApps NV https://github.com/OCA/partner-contact , GRAP https://github.com/OCA/partner-contact , Odoo Community Association (OCA) https://github.com/OCA/partner-contact| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Technical Name |
partner_firstname |
| License | AGPL-3 |
| Website | https://odoo-community.org/ |
| Versions | 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 |
Partner first name and last name
This module was written to extend the functionality of contacts to support having separate last name and first name.
Configuration
You can configure some common name patterns for the inverse function in Settings > Configuration > General settings:
- Lastname Firstname: For example 'Anderson Robert'
- Lastname, Firstname: For example 'Anderson, Robert'
- Firstname Lastname: For example 'Robert Anderson'
After applying the changes, you can recalculate all partners name clicking "Recalculate names" button. Note: This process could take so much time depending how many partners there are in database.
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.
Usage
The field name becomes a stored function field concatenating the last name and the first name. This avoids breaking compatibility with other modules.
Users should fulfill manually the separate fields for last name and first name, but in case you edit just the name field in some unexpected module, there is an inverse function that tries to split that automatically. It assumes that you write the name in format configured ("Lastname Firstname", by default), but it could lead to wrong splitting (because it's just blindly trying to guess what you meant), so you better specify it manually.
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).
For further information, please visit:
Known issues / Roadmap
Patterns for the inverse function are configurable only at system level. Maybe this configuration could depend on partner language, country or company, as discussed at this OCA issue
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.
Credits
Contributors
- Nicolas Bessi <nicolas.bessi@camptocamp.com>
- Yannick Vaucher <yannick.vaucher@camptocamp.com>
- Vincent Renaville <vincent.renaville@camptocamp.com>
- Guewen Baconnier <guewen.baconnier@camptocamp.com>
- Holger Brunn <hbrunn@terp.nl>
- Jonathan Nemry <jonathan.nemry@acsone.eu>
- Olivier Laurent <olivier.laurent@acsone.eu>
- Sandy Carter <sandy.carter@savoirfairelinux.com>
- Alexis de Lattre <alexis.delattre@akretion.fr>
- Lorenzo Battistini <lorenzo.battistini@agilebg.com>
- Hans Henrik Gabelgaard <hhg@gabelgaard.org>
- Jairo Llopis <j.llopis@grupoesoc.es>
- Adrien Peiffer <adrien.peiffer@acsone.eu>
- Ronald Portier <ronald@therp.nl>
- Sylvain Van Hoof
- Pedro Baeza <pedro.baeza@serviciosbaeza.com>
- Dave Lasley <dave@laslabs.com>
Translations
- Danish: Hans Henrik Gabelgaard
- Italian: Leonardo Donelli
- Spanish: Antonio Espinosa
- Antonio Espinosa <antonioea@antiun.com>
Maintainer
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.
Please log in to comment on this module
There are no ratings yet!
Cannot install
Hi,
I had installed the module and uninstalled it. I tried installing it again and i keep on getting this error;
"
Traceback (most recent call last): File "/odoo/odoo-server/odoo/http.py", line 642, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/odoo/odoo-server/odoo/http.py", line 684, in dispatch result = self._call_function(**self.params) File "/odoo/odoo-server/odoo/http.py", line 334, in _call_function return checked_call(self.db, *args, **kwargs) File "/odoo/odoo-server/odoo/service/model.py", line 101, in wrapper return f(dbname, *args, **kwargs) File "/odoo/odoo-server/odoo/http.py", line 327, in checked_call result = self.endpoint(*a, **kw) File "/odoo/odoo-server/odoo/http.py", line 942, in __call__ return self.method(*args, **kw) File "/odoo/odoo-server/odoo/http.py", line 507, in response_wrap response = f(*args, **kw) File "/odoo/odoo-server/addons/web/controllers/main.py", line 899, in call_button action = self._call_kw(model, method, args, {}) File "/odoo/odoo-server/addons/web/controllers/main.py", line 887, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/odoo/odoo-server/odoo/api.py", line 689, in call_kw return call_kw_multi(method, model, args, kwargs) File "/odoo/odoo-server/odoo/api.py", line 680, in call_kw_multi result = method(recs, *args, **kwargs) File "/odoo/odoo-server/odoo/addons/base/module/module.py", line 413, in button_immediate_install return self._button_immediate_function(type(self).button_install) File "/odoo/odoo-server/odoo/addons/base/module/module.py", line 495, in _button_immediate_function modules.registry.Registry.new(self._cr.dbname, update_module=True) File "/odoo/odoo-server/odoo/modules/registry.py", line 83, in new odoo.modules.load_modules(registry._db, force_demo, status, update_module) File "/odoo/odoo-server/odoo/modules/loading.py", line 377, in load_modules loaded_modules, update_module, models_to_check) File "/odoo/odoo-server/odoo/modules/loading.py", line 270, in load_marked_modules perform_checks=perform_checks, models_to_check=models_to_check File "/odoo/odoo-server/odoo/modules/loading.py", line 200, in load_module_graph getattr(py_module, post_init)(cr, registry) File "/odoo/odoo-server/addons/partner_firstname/hooks.py", line 11, in post_init_hook env['res.partner']._install_partner_firstname() File "/odoo/odoo-server/addons/partner_firstname/models/res_partner.py", line 246, in _install_partner_firstname records._inverse_name() File "/odoo/odoo-server/addons/partner_firstname/models/res_partner.py", line 198, in _inverse_name record.lastname = parts['lastname'] File "/odoo/odoo-server/odoo/fields.py", line 970, in __set__ record.write({self.name: write_value}) File "/odoo/odoo-server/odoo/addons/base/res/res_partner.py", line 516, in write result = result and super(Partner, self).write(vals) File "/odoo/odoo-server/addons/mail/models/mail_thread.py", line 276, in write result = super(MailThread, self).write(values) File "/odoo/odoo-server/odoo/models.py", line 3595, in write self._write(old_vals) File "/odoo/odoo-server/odoo/models.py", line 3826, in _write self.recompute() File "/odoo/odoo-server/odoo/models.py", line 5381, in recompute recs.browse(ids)._write(dict(vals)) File "/odoo/odoo-server/odoo/models.py", line 3696, in _write cr.execute(query, params + (sub_ids,)) File "/odoo/odoo-server/odoo/sql_db.py", line 154, in wrapper return f(self, *args, **kwargs) File "/odoo/odoo-server/odoo/sql_db.py", line 231, in execute res = self._obj.execute(query, params) InvalidTextRepresentation: invalid input syntax for integer: "5999-20221129060000" LINE 1: ..., 3, 4, 5, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, '5999-2022...Regards,
Austin
Small missing on signup and user details form
Very good module. But is it normal that this module does not apply the change also on the : - signup form ? - user details form ? It would be good if the user can directly insert firstname + lastname while creating its account. How could we implement this ? Thanks and regards
Does this change leads to first and last name too?
I am not sure if they use the same or not