From f00eb8788af179941a5f08dffee0b5494bf52048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 17 Jul 2022 00:02:22 +0200 Subject: [PATCH] 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 review415271003 --HG-- branch : 6.0 --- web.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web.py b/web.py index e89f20b3fe..8d99f7da90 100644 --- a/web.py +++ b/web.py @@ -193,19 +193,19 @@ class Shop(DeactivableMixin, ModelSQL, ModelView): 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():