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

[16.0][FIX] l10n_br_sale: Sobrescrever o carregamento de impostos para pedidos em empresas brasileiras #3550

Merged
merged 1 commit into from
Dec 18, 2024
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
18 changes: 18 additions & 0 deletions l10n_br_sale/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,21 @@ def _get_fiscal_partner(self):
partner = self.order_id.partner_invoice_id

return partner

@api.depends("product_id", "company_id", "fiscal_tax_ids")
def _compute_tax_id(self):
"""Compute taxes based on fiscal operation or fallback to default behavior."""
lines_with_fiscal_operation = self.filtered(
lambda line: line.fiscal_operation_line_id
)
lines_without_fiscal_operation = self - lines_with_fiscal_operation

for line in lines_with_fiscal_operation:
line.tax_id = line.fiscal_tax_ids.account_taxes(
user_type="sale", fiscal_operation=line.fiscal_operation_id
)

if lines_without_fiscal_operation:
return super(
SaleOrderLine, lines_without_fiscal_operation
)._compute_tax_id()
Loading