Rule reference

BR-23 A line has no unit of measure code (BT-130)

Line 1 has no unit of measure code (BT-130). EN 16931 requires a code from UN/ECE Recommendation 20, not a free-text unit — "hours" is not valid, "HUR" is.

This rule is implemented and its error payload below is real, but the long-form write-up — normative text, worked example, divergence note — is not written yet. Everything the library knows about this rule is on this page. Ask and we will prioritise it.

Business term
BT-130
Severity
fatal

What the library returns

The exact object in result.errors when this rule fires. Generated by running @attestwire/en16931, not transcribed:

TeachingError
{
  "rule": "BR-23",
  "field": "BT-130",
  "severity": "fatal",
  "message": "Line 1 has no unit of measure code (BT-130). EN 16931 requires a code from UN/ECE Recommendation 20, not a free-text unit — \"hours\" is not valid, \"HUR\" is.",
  "fix": "Set line.unitCode to the UN/ECE Rec 20 code: \"HUR\" hours, \"DAY\" days, \"C62\" one/piece, \"MTR\" metres, \"KGM\" kilograms, \"MON\" months.",
  "example": "\"unitCode\": \"HUR\"",
  "xpath": "/ubl:Invoice/cac:InvoiceLine[1]/cbc:InvoicedQuantity/@unitCode",
  "docsUrl": "https://attestwire.com/rules/BR-23"
}

xpath locates the element in the generated UBL document, which is where a KoSIT or Peppol validator will report the same problem.

A passing value

the shape this field expects
"unitCode": "HUR"

The fix

Set line.unitCode to the UN/ECE Rec 20 code: "HUR" hours, "DAY" days, "C62" one/piece, "MTR" metres, "KGM" kilograms, "MON" months.

Arrived from a stack trace? The docsUrl on every error links straight here. Something wrong on this page — tell us.