Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: OCA/l10n-brazil
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8f62943a24a8bf1b3005200baed0d5e786472f01
Choose a base ref
..
head repository: OCA/l10n-brazil
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cfbc894baab90c452be903ed9db0fe5f49b0e57c
Choose a head ref
Showing with 18 additions and 0 deletions.
  1. +18 −0 l10n_br_sale/models/sale_order_line.py
18 changes: 18 additions & 0 deletions l10n_br_sale/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -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()