diff --git a/l10n_nl_partner_name/__manifest__.py b/l10n_nl_partner_name/__manifest__.py index b65700130..c2ef4839b 100644 --- a/l10n_nl_partner_name/__manifest__.py +++ b/l10n_nl_partner_name/__manifest__.py @@ -1,8 +1,8 @@ -# Copyright 2017 Therp BV +# Copyright 2017-24 Therp BV # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Dutch partner names", - "version": "12.0.1.0.0", + "version": "16.0.1.0.0", "author": "Therp BV, Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-netherlands", "category": "Contact management", diff --git a/l10n_nl_partner_name/model/res_partner.py b/l10n_nl_partner_name/model/res_partner.py index 730a9515a..42c5613ed 100644 --- a/l10n_nl_partner_name/model/res_partner.py +++ b/l10n_nl_partner_name/model/res_partner.py @@ -1,9 +1,7 @@ -# Copyright 2017 Therp BV +# Copyright 2017-24 Therp BV # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models -from odoo.addons.mail.models.mail_template import mako_safe_template_env - class ResPartner(models.Model): """Extend res.partner with extra fields for Dutch names.""" @@ -13,7 +11,6 @@ class ResPartner(models.Model): initials = fields.Char() infix = fields.Char() - @api.multi @api.depends("firstname", "lastname", "initials", "infix") def _compute_name(self): for record in self: @@ -21,26 +18,6 @@ def _compute_name(self): record.lastname, record.firstname, record.initials, record.infix ) - @api.onchange("firstname", "lastname", "initials", "infix") - def _onchange_subnames(self): - return super(ResPartner, self)._onchange_subnames() - @api.model def _get_computed_name(self, lastname, firstname, initials=None, infix=None): - name_template = mako_safe_template_env.from_string( - self.env.context.get( - "name_format", - "${firstname or initials or ''}" - "${(firstname or initials) and ' ' or ''}" - "${infix or ''}${infix and ' ' or ''}${lastname or ''}", - ) - ) - name = name_template.render( - { - "firstname": firstname, - "lastname": lastname, - "initials": initials, - "infix": infix, - } - ) - return name if name else "" + return " ".join(p for p in (firstname, initials, infix, lastname) if p) diff --git a/l10n_nl_partner_name/tests/test_l10n_nl_partner_name.py b/l10n_nl_partner_name/tests/test_l10n_nl_partner_name.py index 0aa70cb6c..61616e600 100644 --- a/l10n_nl_partner_name/tests/test_l10n_nl_partner_name.py +++ b/l10n_nl_partner_name/tests/test_l10n_nl_partner_name.py @@ -1,4 +1,4 @@ -# Copyright 2016 Therp BV +# Copyright 2016-24 Therp BV # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo.tests.common import TransactionCase @@ -22,5 +22,4 @@ def test_l10n_nl_partner_name(self): ) self.assertEqual(partner.firstname, "Willem-Alexander") self.assertEqual(partner.lastname, "van Oranje-Nassau") - partner._onchange_subnames() self.assertEqual(partner.name, "Willem-Alexander van Oranje-Nassau") diff --git a/l10n_nl_partner_name/views/res_partner.xml b/l10n_nl_partner_name/views/res_partner.xml index 30906d27e..1fd048f37 100644 --- a/l10n_nl_partner_name/views/res_partner.xml +++ b/l10n_nl_partner_name/views/res_partner.xml @@ -2,10 +2,7 @@ res.partner.simplified.form.firstname res.partner - +
@@ -45,7 +42,7 @@ res.partner.form.firstname res.partner - +