Attestwire › Rule reference › BR-42
BR-42 Every line allowance must state a reason or reason code
noun · EN 16931 · fatal · BT-139 / BT-140
For a sample invoice, the library reports: The invoice line allowance at lines[0].allowances[0], on line 1 (id "1"), states neither a reason (BT-139) nor a reason code (BT-140). Every BG-27 group must carry at least one.
- Business term
BT-139 / BT-140- Severity
fatal
The fix
Set lines[0].allowances[0].reason to a short description, or lines[0].allowances[0].reasonCode to a UNCL 5189 code, or both. Under XRechnung, prefer the free text: the mandated visualisation renders the code verbatim, so a buyer looking at the rendered invoice sees the bare code and not what it means.
A passing value
"allowances": [{ "amount": 12.50, "reason": "Special agreement", "reasonCode": "100" }]What the library returns
The full error returned by @attestwire/en16931. It includes the rule ID,
affected field and suggested correction. Developers can use this object in their application:
{
"rule": "BR-42",
"field": [
"BT-139",
"BT-140"
],
"severity": "fatal",
"message": "The invoice line allowance at lines[0].allowances[0], on line 1 (id \"1\"), states neither a reason (BT-139) nor a reason code (BT-140). Every BG-27 group must carry at least one. A line level adjustment is harder to query than a document level one, because it disappears into the line net amount: the buyer sees a line total that does not equal quantity x price and has no way to find out why unless you say.",
"fix": "Set lines[0].allowances[0].reason to a short description, or lines[0].allowances[0].reasonCode to a UNCL 5189 code, or both. Under XRechnung, prefer the free text: the mandated visualisation renders the code verbatim, so a buyer looking at the rendered invoice sees the bare code and not what it means.",
"example": "\"allowances\": [{ \"amount\": 12.50, \"reason\": \"Special agreement\", \"reasonCode\": \"100\" }]",
"xpath": "/ubl:Invoice/cac:InvoiceLine[1]/cac:AllowanceCharge[1]/cbc:AllowanceChargeReason",
"docsUrl": "https://attestwire.com/rules/BR-42"
}
xpath is always a UBL path. On a CII invoice, look for the
matching CII field instead.