changeset 60fe20c8a431 in modules/purchase:default
details: https://hg.tryton.org/modules/purchase?cmd=changeset&node=60fe20c8a431
description:
Ensure unique taxes when applying tax rule
Since issue10841 the taxes must be unique so the tax rule application
must
result on unique taxes.
issue11230
review419361003
diffstat:
purchase.py | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diffs (29 lines):
diff -r c9377d520421 -r 60fe20c8a431 purchase.py
--- a/purchase.py Sat Jul 09 23:17:58 2022 +0200
+++ b/purchase.py Sun Jul 17 00:00:56 2022 +0200
@@ -1332,20 +1332,20 @@
@fields.depends('product', methods=['_get_tax_rule_pattern'])
def compute_taxes(self, party):
- taxes = []
+ taxes = set()
pattern = self._get_tax_rule_pattern()
for tax in self.product.supplier_taxes_used:
if party and party.supplier_tax_rule:
tax_ids = party.supplier_tax_rule.apply(tax, pattern)
if tax_ids:
- taxes.extend(tax_ids)
+ taxes.update(tax_ids)
continue
- taxes.append(tax.id)
+ taxes.add(tax.id)
if party and party.supplier_tax_rule:
tax_ids = party.supplier_tax_rule.apply(None, pattern)
if tax_ids:
- taxes.extend(tax_ids)
- return taxes
+ taxes.update(tax_ids)
+ return list(taxes)
@fields.depends('product', 'quantity',
methods=['_get_context_purchase_price'])