Skip to content

Commit

Permalink
[IMP] l10n_br_cnpj_search: default_get from res.partner
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago370 committed Oct 24, 2024
1 parent bfb11f7 commit 4188871
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions l10n_br_cnpj_search/wizard/partner_cnpj_search_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ def _get_partner_values(self, cnpj_cpf):
def default_get(self, fields):
res = super().default_get(fields)
partner_id = self.env.context.get("default_partner_id")
partner_model = self.env["res.partner"]
partner = partner_model.browse(partner_id)
cnpj_cpf = punctuation_rm(partner.cnpj_cpf)
misc.punctuation_rm(self.zip)
values = self._get_partner_values(cnpj_cpf)
res.update(values)
if partner_id:
partner_model = self.env["res.partner"]
partner = partner_model.browse(partner_id)
cnpj_cpf = punctuation_rm(partner.cnpj_cpf)
misc.punctuation_rm(self.zip)
values = self._get_partner_values(cnpj_cpf)
res.update(values)
return res

def action_update_partner(self):
Expand Down

0 comments on commit 4188871

Please sign in to comment.