details:   https://code.tryton.org/tryton/commit/850d8cda06df
branch:    default
user:      Rémi Letot <[email protected]>
date:      Tue Oct 27 14:57:05 2026 +0100
description:
        Do not deduct allowances or add charges to the tax-exclusive amount 
from UBL

        According to BR-CO-13 the tax-exclusive amount already includes the 
allowances
        and charges. This means that it can be used directly as the source of 
untaxed
        amount.

        Closes #15165
diffstat:

 modules/edocument_ubl/edocument.py |  32 ++++----------------------------
 1 files changed, 4 insertions(+), 28 deletions(-)

diffs (51 lines):

diff -r 5872d8b84042 -r 850d8cda06df modules/edocument_ubl/edocument.py
--- a/modules/edocument_ubl/edocument.py        Mon Oct 26 09:00:12 2026 +0100
+++ b/modules/edocument_ubl/edocument.py        Tue Oct 27 14:57:05 2026 +0100
@@ -413,21 +413,9 @@
                     is not None)):
             invoice.cash_rounding = True
 
-        if tax_exlusive_amount := root.findtext(
+        if tax_exclusive_amount := root.findtext(
                 './{*}LegalMonetaryTotal/{*}TaxExclusiveAmount'):
-            untaxed_amount = Decimal(tax_exlusive_amount)
-
-            if allowance_total_amount := root.findtext(
-                    './{*}LegalMonetaryTotal/{*}AllowanceTotalAmount'):
-                allowance_total_amount = Decimal(allowance_total_amount)
-                untaxed_amount -= allowance_total_amount
-
-            if charge_total_amount := root.findtext(
-                    './{*}LegalMonetaryTotal/{*}ChargeTotalAmount'):
-                charge_total_amount = Decimal(charge_total_amount)
-                untaxed_amount += charge_total_amount
-
-            invoice.source_untaxed_amount = untaxed_amount
+            invoice.source_untaxed_amount = Decimal(tax_exclusive_amount)
 
         tax_amount = sum(Decimal(amount.text) for amount in root.iterfind(
                 './{*}TaxTotal/{*}TaxAmount'))
@@ -738,21 +726,9 @@
                 is not None):
             invoice.cash_rounding = True
 
-        if tax_exlusive_amount := root.findtext(
+        if tax_exclusive_amount := root.findtext(
                 './{*}LegalMonetaryTotal/{*}TaxExclusiveAmount'):
-            untaxed_amount = Decimal(tax_exlusive_amount)
-
-            if allowance_total_amount := root.findtext(
-                    './{*}LegalMonetaryTotal/{*}AllowanceTotalAmount'):
-                allowance_total_amount = Decimal(allowance_total_amount)
-                untaxed_amount -= allowance_total_amount
-
-            if charge_total_amount := root.findtext(
-                    './{*}LegalMonetaryTotal/{*}ChargeTotalAmount'):
-                charge_total_amount = Decimal(charge_total_amount)
-                untaxed_amount += charge_total_amount
-
-            invoice.source_untaxed_amount = -untaxed_amount
+            invoice.source_untaxed_amount = -Decimal(tax_exclusive_amount)
 
         tax_amount = sum(Decimal(amount.text) for amount in root.iterfind(
                 './{*}TaxTotal/{*}TaxAmount'))

Reply via email to