From 59e04dbf592b42eee1747c42e99d797577a6069d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Jan 2026 17:39:35 +0100 Subject: [PATCH] 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 --- modules/edocument_ubl/edocument.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/edocument_ubl/edocument.py b/modules/edocument_ubl/edocument.py index e949c62eb6..ebad313bb9 100644 --- a/modules/edocument_ubl/edocument.py +++ b/modules/edocument_ubl/edocument.py @@ -329,7 +329,8 @@ class Invoice(Model): 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 @@ class Invoice(Model): 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),