Skip to content

[18.0+] account_edi_ubl_cii: IBR-022 wrongly reports "Invoiced quantity is missing" for invoice lines with quantity 0 #289575

Description

@Robrechtc

Odoo Version

  • 17.0
  • 18.0
  • 19.0
  • Other (specify)

Steps to Reproduce

Impacted versions

  • 18.0 (reproduced on Odoo.sh on a client environment)
  • master / saas-* carry the same code

The constraint was introduced in 18.0 by 081221a ("[FIX] account_edi_ubl_cii, account_peppol: make PINT use UBL export", 2026-08-20). Before that commit the same invoices were exported and sent over Peppol without any error.

Steps to reproduce

  1. Belgian company, Peppol enabled, customer with a Peppol endpoint.
  2. Create a customer invoice with several lines, and set Quantity = 0 on at least one of them (unit price and taxes set normally, so the line totals 0.00).
  3. Confirm the invoice.
  4. Print & Send → check per e-mail and met Peppol → Send.

Current behavior

Sending is blocked by an Invalid Operation dialog:

Image

The reported lines are exactly the lines with quantity 0. The quantity is not missing — cbc:InvoicedQuantity is built for every line and renders as 0.0.

Cause — addons/account_edi_ubl_cii/models/account_edi_ubl_pint.py:504-509 (18.0):

# [IBR-022] - Each Invoice line (ibg-25) MUST have an invoiced quantity (ibt-129).
qty_node = line['cbc:InvoicedQuantity'] if is_invoice else line.get('cbc:CreditedQuantity', {})
if qty_node.get('_text') in [None, False]:

_text is the raw float from _ubl_add_line_invoiced_quantity_node (base_line['quantity'], account_edi_ubl.py:859-864). In Python 0.0 == False, so 0.0 in [None, False] evaluates to True and a present, valid quantity of 0 is reported as missing.

account.edi.xml.ubl_bis3 inherits account.edi.ubl_pint_eu, so this affects plain Peppol BIS Billing 3.0 exports, not only PINT.

Expected behavior

A line with quantity 0 exports and sends normally. EN16931 BR-22 requires the invoiced quantity to be present, and 0 is a valid value — the generated XML already contains <cbc:InvoicedQuantity unitCode="C62">0.0</cbc:InvoicedQuantity>, which passes the official OpenPeppol schematron.

Suggested fix

Test for absence instead of falsiness:

qty_text = qty_node.get('_text')
if qty_text is None or qty_text is False:

The neighbouring IBR checks that use if not ... on numeric _text values are worth a look for the same problem.

Workaround

Remove the zero-quantity lines, or give them quantity 1 at price 0.

Log Output

Support Ticket

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions