Skip to content

[Bug]: XRechnung export rounds Quantity to 2 decimals instead of unlimited, causing calculation mismatch #29745

@miljance

Description

@miljance

Describe the issue

When exporting an E-Document using the XRechnung format in Business Central, the Quantity field in the generated XML is being rounded to 2 decimal places. This occurs even when the source Sales Invoice Line contains a quantity with higher precision (e.g., 4 decimals).

While ZUGFeRD handles this correctly, the XRechnung implementation leads to an invalid XML structure because the calculation Unit Price * Quantity no longer matches the Line Amount due to the loss of precision. This results in rejection when the file is uploaded to official German portals or validated online.

Expected behavior

The XRechnung export should support unlimited decimal places for the quantity, matching the ZUGFeRD implementation and the EN 16931 standard. The XML should reflect the exact precision entered in Business Central to ensure that Quantity * Price correctly equals the Line Amount.

Steps to reproduce

  1. Use Business Central for Germany.

  2. Enable E-Document Service for XRechnung.

  3. In setup:

    • Buyer Reference Mandatory = Yes
    • Buyer Reference = Customer Reference
  4. Configure a Workflow and a Document Sending Profile for XRechnung (per docs).

  5. Mark this sending profile as the default profile and assign it to a Customer.

  6. Create a new Sales Invoice for this Customer.

  7. Create a Sales Invoice line with:

    • Quantity: 1.2345
    • Unit Price: 100.00
    • (Verify Line Amount is 123.45)
  8. Post the Sales Invoice.

  9. Open the Posted Sales Invoice and navigate to Related -> E-Document -> Open E-Document.

  10. From E-Document Logs, export the XML file.

  11. Observe the XML: <cbc:InvoicedQuantity> is exported as 1.23 instead of 1.2345.

  12. Upload the file to the https://erechnungs-validator.de/

  13. Observe the validation error

Additional context

No response

I will provide a fix for a bug

  • I will provide a fix for a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance areaapprovedThe issue is approved

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions