details:   https://code.tryton.org/tryton/commit/ebe6527b6ff3
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Jan 22 17:39:35 2026 +0100
description:
        Do not search unit of measure for unit code ZZ and XZZ from UBL

        The mutually defined unit should let the system choose a default unit.

        Closes #14537
diffstat:

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

diffs (23 lines):

diff -r e787aff12b41 -r ebe6527b6ff3 modules/edocument_ubl/edocument.py
--- a/modules/edocument_ubl/edocument.py        Thu Jan 22 17:38:18 2026 +0100
+++ b/modules/edocument_ubl/edocument.py        Thu Jan 22 17:39:35 2026 +0100
@@ -329,7 +329,8 @@
         if (invoiced_quantity := invoice_line.find('./{*}InvoicedQuantity')
                 ) is not None:
             line.quantity = float(invoiced_quantity.text)
-            if (unit_code := invoiced_quantity.get('unitCode')) is not None:
+            if (unit_code := invoiced_quantity.get('unitCode')) not in {
+                    None, 'ZZ', 'XZZ'}:
                 try:
                     line.unit, = UoM.search([
                             ('unece_code', '=', unit_code),
@@ -501,7 +502,8 @@
         if (credited_quantity := credit_note_line.find('./{*}CreditedQuantity')
                 ) is not None:
             line.quantity = -float(credited_quantity.text)
-            if (unit_code := credited_quantity.get('unitCode')) is not None:
+            if (unit_code := credited_quantity.get('unitCode')) not in {
+                    None, 'ZZ', 'XZZ'}:
                 try:
                     line.unit, = UoM.search([
                             ('unece_code', '=', unit_code),

Reply via email to