Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][IMP] l10n_br_purchase: improving the search by fiscal document type (port from 14.0) #3590

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -112,11 +112,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
Loading