Skip to content

Commit

Permalink
[REF] l10n_br_base: inscr_mun -> l10n_br_im_code
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalyi committed Dec 31, 2024
1 parent 401fb34 commit e667317
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
5 changes: 4 additions & 1 deletion l10n_br_base/models/party_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions l10n_br_base/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_base/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ 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
if parent.country_id.code == "BR":
parent.legal_name = parent.name
parent.cnpj_cpf = parent.vat
parent.inscr_est = inscr_est
parent.inscr_mun = inscr_mun
parent.inscr_mun = l10n_br_im_code
return res

def _is_br_partner(self):
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_base/views/res_company_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
attrs="{'invisible': [('country_id', '!=', %(base.br)d)]}"
/>
<field
name="inscr_mun"
name="l10n_br_im_code"
placeholder="Municipal Tax Number..."
attrs="{'invisible': [('country_id', '!=', %(base.br)d)]}"
/>
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_base/views/res_partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<group string="Fiscal Infos" name="fiscal_numbers">
<field name="cei_code" />
<field
name="inscr_mun"
name="l10n_br_im_code"
attrs="{'invisible': [('is_company','!=', True)]}"
/>
<field
Expand Down

0 comments on commit e667317

Please sign in to comment.