changeset 4b2d18f8cd61 in modules/stock_consignment:default
details:
https://hg.tryton.org/modules/stock_consignment?cmd=changeset&node=4b2d18f8cd61
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:
stock.py | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diffs (51 lines):
diff -r 578c5659535a -r 4b2d18f8cd61 stock.py
--- a/stock.py Mon May 02 17:46:35 2022 +0200
+++ b/stock.py Sun Jul 17 00:00:56 2022 +0200
@@ -186,19 +186,19 @@
line.stock_moves = [self]
line.origin = self
- taxes = []
+ taxes = set()
pattern = self._get_tax_rule_pattern()
for tax in line.product.supplier_taxes_used:
if line.party.supplier_tax_rule:
tax_ids = line.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 line.party.supplier_tax_rule:
tax_ids = line.party.supplier_tax_rule.apply(None, pattern)
if tax_ids:
- taxes.extend(tax_ids)
+ taxes.update(tax_ids)
line.taxes = taxes
with Transaction().set_context(
@@ -231,19 +231,19 @@
line.stock_moves = [self]
line.origin = self
- taxes = []
+ taxes = set()
pattern = self._get_tax_rule_pattern()
for tax in line.product.customer_taxes_used:
if line.party.customer_tax_rule:
tax_ids = line.party.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 line.party.customer_tax_rule:
tax_ids = line.party.customer_tax_rule.apply(None, pattern)
if tax_ids:
- taxes.extend(tax_ids)
+ taxes.update(tax_ids)
line.taxes = taxes
with Transaction().set_context(