changeset b7d48e6fb076 in modules/web_shop_shopify:default
details: 
https://hg.tryton.org/modules/web_shop_shopify?cmd=changeset&node=b7d48e6fb076
description:
        Ensure to always use the same tax instances when applying tax adjustment

        issue11720
        review427771003
diffstat:

 sale.py |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 66be3877c762 -r b7d48e6fb076 sale.py
--- a/sale.py   Sun Sep 25 20:29:57 2022 +0200
+++ b/sale.py   Sun Sep 25 20:30:54 2022 +0200
@@ -161,7 +161,8 @@
                 round=False)
             remaining = invoice.currency.round(
                 adjustment * (invoice.untaxed_amount / untaxed_amount))
-            for tax in invoice.taxes:
+            taxes = invoice.taxes
+            for tax in taxes:
                 if tax.amount:
                     if invoice.tax_amount:
                         ratio = tax.amount / invoice.tax_amount
@@ -171,11 +172,11 @@
                     tax.amount += value
                     remaining -= value
             if remaining:
-                for tax in invoice.taxes:
+                for tax in taxes:
                     if tax.amount:
                         tax.amount += remaining
                         break
-            invoice.taxes = invoice.taxes
+            invoice.taxes = taxes
             invoice.save()
             invoice.update_taxes()
         return invoice

Reply via email to