Skip to content

Commit

Permalink
[REF] l10n_br_nfe: cnpj_cpf is now a related of vat
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalyi committed Dec 29, 2024
1 parent e63e811 commit 6996b70
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions l10n_br_nfe/models/dfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _create_mde_from_procNFe(self, root):
return mde_id

supplier_cnpj = utils.mask_cnpj("%014d" % root.NFe.infNFe.emit.CNPJ)
partner = self.env["res.partner"].search([("cnpj_cpf", "=", supplier_cnpj)])
partner = self.env["res.partner"].search([("vat", "=", supplier_cnpj)])

return self.env["l10n_br_nfe.mde"].create(
{
Expand Down Expand Up @@ -87,7 +87,7 @@ def _create_mde_from_resNFe(self, root):
return mde_id

supplier_cnpj = utils.mask_cnpj("%014d" % root.CNPJ)
partner_id = self.env["res.partner"].search([("cnpj_cpf", "=", supplier_cnpj)])
partner_id = self.env["res.partner"].search([("vat", "=", supplier_cnpj)])

return self.env["l10n_br_nfe.mde"].create(
{
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_nfe/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ def match_or_create_m2o(self, rec_dict, parent_dict, model=None):
if rec_dict.get("cnpj_cpf", False):
domain_cnpj = [
"|",
("cnpj_cpf", "=", rec_dict["cnpj_cpf"]),
("cnpj_cpf", "=", cnpj_cpf.formata(rec_dict["cnpj_cpf"])),
("cnpj_cpf_stripped", "=", rec_dict["cnpj_cpf"]),
("vat", "=", cnpj_cpf.formata(rec_dict["cnpj_cpf"])),
]
match = self.search(domain_cnpj, limit=1)
if match:
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_nfe/wizards/import_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _fill_wizard_from_binding(self):
self.partner_id = self.env["res.partner"].search(
[
"|",
("cnpj_cpf", "=", infNFe.emit.CNPJ),
("vat", "=", infNFe.emit.CNPJ),
("nfe40_xNome", "=", infNFe.emit.xNome),
],
limit=1,
Expand Down

0 comments on commit 6996b70

Please sign in to comment.