Skip to content

Commit

Permalink
[IMP] l10n_br_purchase: improving the search by fiscal document type
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Jan 15, 2025
1 parent 722e826 commit 3a03fa7
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 @@ -108,11 +108,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 3a03fa7

Please sign in to comment.