From 533a5e90f93cfd7fe3f60cb7b73eb90b1f3aae76 Mon Sep 17 00:00:00 2001 From: payen000 Date: Mon, 23 May 2022 22:55:34 +0000 Subject: [PATCH] [REF] partner_firstname,partner_second_lastname: Avoid _inverse_name when recalculating names The modification to action_recalculate_partners_name prevents the _inverse_name method from triggering when recalculating the names of partners, leaving the firstname, lastname and lastname2 fields intact. --- partner_firstname/models/base_config_settings.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/partner_firstname/models/base_config_settings.py b/partner_firstname/models/base_config_settings.py index 76c2f1f91..7f44c147b 100644 --- a/partner_firstname/models/base_config_settings.py +++ b/partner_firstname/models/base_config_settings.py @@ -62,7 +62,10 @@ class ResConfigSettings(models.TransientModel): ) partners = self._partners_for_recalculating() _logger.info("Recalculating names for %d partners.", len(partners)) - partners._compute_name() + # Use add_to_compute instead of _compute_name to avoid triggering + # _inverse_name_after_cleaning_whitespace, which can + # modify a partner's firstname, lastname and lastname2 + self.env.add_to_compute(self.env["res.partner"]._fields["name"], partners) self.partner_names_order_changed = False self.execute() _logger.info("%d partners updated.", len(partners))