diff --git a/l10n_br_base/models/party_mixin.py b/l10n_br_base/models/party_mixin.py index 04557895aef8..6911f4eb3590 100644 --- a/l10n_br_base/models/party_mixin.py +++ b/l10n_br_base/models/party_mixin.py @@ -43,12 +43,15 @@ class PartyMixin(models.AbstractModel): inverse_name="partner_id", ) - inscr_mun = fields.Char( + l10n_br_im_code = fields.Char( string="Municipal Tax Number", size=18, unaccent=False, ) + # backward compat with v14: + inscr_mun = fields.Char(related="l10n_br_im_code", readonly=False) + suframa = fields.Char( size=18, unaccent=False, diff --git a/l10n_br_base/models/res_company.py b/l10n_br_base/models/res_company.py index 59668ba75cb6..2a301ecff50f 100644 --- a/l10n_br_base/models/res_company.py +++ b/l10n_br_base/models/res_company.py @@ -20,7 +20,7 @@ def _get_company_address_field_names(self): "legal_name", "cnpj_cpf", "inscr_est", - "inscr_mun", + "l10n_br_im_code", "district", "city_id", "suframa", @@ -72,10 +72,10 @@ def _inverse_state_tax_number_ids(self): state_tax_number_ids |= ies company.partner_id.state_tax_number_ids = state_tax_number_ids - def _inverse_inscr_mun(self): + def _inverse_l10n_br_im_code(self): """Write the l10n_br specific functional fields.""" for company in self: - company.partner_id.inscr_mun = company.inscr_mun + company.partner_id.l10n_br_im_code = company.l10n_br_im_code def _inverse_city_id(self): """Write the l10n_br specific functional fields.""" @@ -133,9 +133,9 @@ def _inverse_suframa(self): inverse="_inverse_state_tax_number_ids", ) - inscr_mun = fields.Char( + l10n_br_im_code = fields.Char( compute="_compute_address", - inverse="_inverse_inscr_mun", + inverse="_inverse_l10n_br_im_code", ) suframa = fields.Char( diff --git a/l10n_br_base/models/res_partner.py b/l10n_br_base/models/res_partner.py index 48c108830577..2eb8a57202b4 100644 --- a/l10n_br_base/models/res_partner.py +++ b/l10n_br_base/models/res_partner.py @@ -203,7 +203,7 @@ def _compute_show_l10n_br(self): def create_company(self): self.ensure_one() inscr_est = self.inscr_est - inscr_mun = self.inscr_mun + inscr_mun = self.l10n_br_im_code res = super().create_company() if res: parent = self.parent_id diff --git a/l10n_br_base/views/res_company_view.xml b/l10n_br_base/views/res_company_view.xml index 32a13a1a0b9c..9e43c1b3f13c 100644 --- a/l10n_br_base/views/res_company_view.xml +++ b/l10n_br_base/views/res_company_view.xml @@ -30,7 +30,7 @@ attrs="{'invisible': [('country_id', '!=', %(base.br)d)]}" /> diff --git a/l10n_br_base/views/res_partner_view.xml b/l10n_br_base/views/res_partner_view.xml index b2e4f04a49a7..15237ec83ac3 100644 --- a/l10n_br_base/views/res_partner_view.xml +++ b/l10n_br_base/views/res_partner_view.xml @@ -112,7 +112,7 @@