changeset b31d8703761f in modules/web_shop:default
details: https://hg.tryton.org/modules/web_shop?cmd=changeset&node=b31d8703761f
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:
web.py | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diffs (28 lines):
diff -r a93de8dacc4e -r b31d8703761f web.py
--- a/web.py Sat Jul 09 23:15:20 2022 +0200
+++ b/web.py Sun Jul 17 00:00:56 2022 +0200
@@ -196,19 +196,19 @@
customer_tax_rule = self._customer_taxe_rule()
taxes2products = defaultdict(list)
for product in all_products:
- taxes = []
+ taxes = set()
for tax in product.customer_taxes_used:
if customer_tax_rule:
tax_ids = customer_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 customer_tax_rule:
tax_ids = customer_tax_rule.apply(None, pattern)
if tax_ids:
- taxes.extend(tax_ids)
- taxes2products[tuple(taxes)].append(product)
+ taxes.update(tax_ids)
+ taxes2products[tuple(sorted(taxes))].append(product)
prices, taxes = {}, {}
for tax_ids, products in taxes2products.items():