diff --git a/partner_firstname/models.py b/partner_firstname/models.py index 86037a3eb..83aa50a88 100644 --- a/partner_firstname/models.py +++ b/partner_firstname/models.py @@ -96,6 +96,12 @@ class ResPartner(models.Model): if not (self.firstname or self.lastname): raise exceptions.EmptyNamesError(self) + @api.one + @api.onchange("name") + def _onchange_name(self): + """Ensure :attr:`~.name` is inverted in the UI.""" + self._inverse_name_after_cleaning_whitespace() + @api.model def _install_partner_firstname(self): """Save names correctly in the database. diff --git a/partner_firstname/views/res_partner.xml b/partner_firstname/views/res_partner.xml index 51c913ecb..0838628eb 100644 --- a/partner_firstname/views/res_partner.xml +++ b/partner_firstname/views/res_partner.xml @@ -17,10 +17,12 @@ - - + - - + - - +