Skip to content

Commit

Permalink
Merge PR #1938 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Jun 14, 2022
2 parents 44b102b + c3f5dbc commit 28f97dd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions l10n_br_nfe/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,23 @@ def _build_many2one(self, comodel, vals, new_value, key, value, path):
super()._build_many2one(
self.env["res.partner"], vals, new_value, "partner_id", value, path
)
elif key == "nfe40_entrega" and self.env.context.get("edoc_type") == "in":
enderEntreg_value = self.env["res.partner"].build_attrs(value, path=path)
new_value.update(enderEntreg_value)
parent_domain = [("nfe40_CNPJ", "=", new_value.get("nfe40_CNPJ"))]
parent_partner_match = self.env["res.partner"].search(
parent_domain, limit=1
)
new_vals = {
"nfe40_CNPJ": False,
"type": "delivery",
"parent_id": parent_partner_match.id,
"company_type": "person",
}
new_value.update(new_vals)
super()._build_many2one(
self.env["res.partner"], vals, new_value, key, value, path
)
elif self.env.context.get("edoc_type") == "in" and key in [
"nfe40_dest",
"nfe40_enderDest",
Expand Down

0 comments on commit 28f97dd

Please sign in to comment.