Skip to content

Commit

Permalink
[MIG] Address format
Browse files Browse the repository at this point in the history
  • Loading branch information
mileo committed Oct 16, 2022
1 parent b72847b commit c7750de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions l10n_br_base/data/res_country_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,12 @@
<field name="bc_code">1058</field>
<field name="siscomex_code">105</field>
<field name="enforce_cities">1</field>
<field name="street_format" eval="'%(street_name)s, %(street_number)s'" />
<field name="name_position">before</field>
<field
name="address_format"
eval="'%(street)s %(street2)s\n%(district)s\n%(zip)s - %(city)s-%(state_code)s\n%(country_name)s'"
/>
<field name="address_view_id" ref="l10n_br_base_res_partner_address" />
<!-- <field name="address_view_id" ref="l10n_br_base_res_partner_address" /> -->
<field name="vat_label">CNPJ/CPF</field>
</record>

Expand Down
10 changes: 10 additions & 0 deletions l10n_br_base/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ class Partner(models.Model):
_name = "res.partner"
_inherit = [_name, "l10n_br_base.party.mixin"]

def _inverse_street_data(self):
"""update self.street based on street_name, street_number and street_number2"""
for partner in self:
street = (
(partner.street_name or "") + ", " + (partner.street_number or "")
).strip()
if partner.street_number2:
street = street + " - " + partner.street_number2
partner.street = street

vat = fields.Char(related="cnpj_cpf")

is_accountant = fields.Boolean(string="Is accountant?")
Expand Down

0 comments on commit c7750de

Please sign in to comment.