Skip to content

Commit

Permalink
Merge PR #3591 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Jan 17, 2025
2 parents ef2bf4f + 19d649f commit 7673e5a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion l10n_br_purchase/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,22 @@ def _prepare_invoice(self):
invoice_vals = super()._prepare_invoice()
if self.fiscal_operation_id:
# O caso Brasil se caracteriza por ter a Operação Fiscal
document_type_id = (
self.order_line[0].fiscal_operation_line_id.document_type_id.id
if self.order_line
and self.order_line[0].fiscal_operation_line_id.document_type_id
else (
self.fiscal_operation_id.document_type_ids[0].document_type_id.id
if self.fiscal_operation_id
and self.fiscal_operation_id.document_type_ids
else self.company_id.document_type_id.id
)
)
invoice_vals.update(
{
"ind_final": self.ind_final,
"fiscal_operation_id": self.fiscal_operation_id.id,
"document_type_id": self.company_id.document_type_id.id,
"document_type_id": document_type_id,
}
)
return invoice_vals
Expand Down

0 comments on commit 7673e5a

Please sign in to comment.