Browse Source

[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.
14.0
payen000 3 years ago
parent
commit
533a5e90f9
  1. 5
      partner_firstname/models/base_config_settings.py

5
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))

Loading…
Cancel
Save