changeset 7dc8f95b54d1 in modules/project_invoice:6.0
details: 
https://hg.tryton.org/modules/project_invoice?cmd=changeset&node=7dc8f95b54d1
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
        review415271003
diffstat:

 project.py |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r e24726a22127 -r 7dc8f95b54d1 project.py
--- a/project.py        Fri Jul 01 23:40:37 2022 +0200
+++ b/project.py        Sun Jul 17 00:02:21 2022 +0200
@@ -589,7 +589,7 @@
         invoice_line.currency = invoice.currency
         invoice_line.company = invoice.company
 
-        taxes = []
+        taxes = set()
         pattern = invoice_line._get_tax_rule_pattern()
         party = invoice.party
         original_taxes = (
@@ -598,13 +598,13 @@
             if party.customer_tax_rule:
                 tax_ids = 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 party.customer_tax_rule:
             tax_ids = party.customer_tax_rule.apply(None, pattern)
             if tax_ids:
-                taxes.extend(tax_ids)
+                taxes.update(tax_ids)
         invoice_line.taxes = taxes
         return invoice_line
 

Reply via email to