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
This commit is contained in:
Cédric Krier
2026-01-22 17:39:35 +01:00
parent acb2d60609
commit 59e04dbf59
+4 -2
View File
@@ -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),