Skip to content
Snippets Groups Projects
Commit 40924c15 authored by Sergi Almacellas Abellana's avatar Sergi Almacellas Abellana
Browse files

Apply tax rule with empty taxes when creating purchase

issue6524
review35011002
parent aadd9781
No related merge requests found
......@@ -470,4 +470,6 @@
Decimal(1) / 10 ** Line.unit_price.digits[1])
line.unit_price = product_price
taxes = []
pattern = cls._get_tax_rule_pattern(line, purchase)
if line.product:
......@@ -473,4 +475,3 @@
if line.product:
taxes = []
for tax in line.product.supplier_taxes_used:
if purchase.party and purchase.party.supplier_tax_rule:
......@@ -475,9 +476,8 @@
for tax in line.product.supplier_taxes_used:
if purchase.party and purchase.party.supplier_tax_rule:
pattern = cls._get_tax_rule_pattern(line, purchase)
tax_ids = purchase.party.supplier_tax_rule.apply(
tax, pattern)
if tax_ids:
taxes.extend(tax_ids)
continue
taxes.append(tax.id)
......@@ -478,9 +478,13 @@
tax_ids = purchase.party.supplier_tax_rule.apply(
tax, pattern)
if tax_ids:
taxes.extend(tax_ids)
continue
taxes.append(tax.id)
if purchase.party and purchase.party.supplier_tax_rule:
tax_ids = purchase.party.supplier_tax_rule.apply(None, pattern)
if tax_ids:
taxes.extend(tax_ids)
line.taxes = taxes
return line
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment