diff --git a/l10n_fr_chorus_account/models/account_move.py b/l10n_fr_chorus_account/models/account_move.py index e870c4ed2..a6524f269 100644 --- a/l10n_fr_chorus_account/models/account_move.py +++ b/l10n_fr_chorus_account/models/account_move.py @@ -87,6 +87,11 @@ class AccountMove(models.Model): transmit_method_id = fields.Many2one( readonly=True, states={"draft": [("readonly", False)]} ) + chorus_service_code = fields.Char( + related="partner_id.fr_chorus_service_id.code", + string="Chorus Service Code", + store=True, + ) @api.constrains("chorus_attachment_ids", "transmit_method_id") def _check_chorus_attachments(self): diff --git a/l10n_fr_chorus_account/models/res_partner.py b/l10n_fr_chorus_account/models/res_partner.py index 64e6579ff..0a9d1a7ce 100644 --- a/l10n_fr_chorus_account/models/res_partner.py +++ b/l10n_fr_chorus_account/models/res_partner.py @@ -94,21 +94,6 @@ def check_fr_chorus_service(self): } ) - def _get_name(self): - name = super()._get_name() - if ( - name - and self.fr_chorus_service_id - and not self._context.get("hide_chorus_service") - ): - if "\n" in name: - field_label = _("Chorus Service Code:") - name = f"{name}\n{field_label} {self.fr_chorus_service_id.code}" - else: - # We put it at the start, because it is cut if too long in M2O - name = f"(Chorus {self.fr_chorus_service_id.code}) {name})" - return name - def fr_chorus_api_structures_rechercher(self, api_params, session=None): url_path = "structures/v1/rechercher" payload = { diff --git a/l10n_fr_chorus_account/views/account_move.xml b/l10n_fr_chorus_account/views/account_move.xml index 89b040fcd..51e221923 100644 --- a/l10n_fr_chorus_account/views/account_move.xml +++ b/l10n_fr_chorus_account/views/account_move.xml @@ -10,6 +10,12 @@ account.move + + +