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
This commit is contained in:
Cédric Krier committed 2022-07-17 00:02:22 +02:00
1 parent 4251e9fbeb
commit f00eb8788a
1 file changed
+5 -5
+5 -5
View File
@@ -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():