Item base quantity & line unit of measure (EN 16931 BT-149/150/130) - #881
Draft
alvarolivie wants to merge 1 commit into
Draft
Item base quantity & line unit of measure (EN 16931 BT-149/150/130)#881alvarolivie wants to merge 1 commit into
alvarolivie wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #881 +/- ##
=======================================
Coverage 94.75% 94.76%
=======================================
Files 343 343
Lines 18815 18835 +20
=======================================
+ Hits 17829 17849 +20
Misses 600 600
Partials 386 386 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
13 tasks
…130) - org.Item.BaseQuantity (BT-149): the number of units the price refers to; line sums are price × quantity ÷ base_quantity. Validated as positive. - bill.Line.Unit / SubLine.Unit (BT-130): the invoiced quantity unit of measure, distinct from the item's price base quantity unit (Item.Unit, BT-150). Core EN 16931 permits them to differ; only PEPPOL requires equal. - Normalization seeds Item.Unit (BT-150) from a line-only unit but never the reverse, so existing documents (and their digests) are unchanged. Converters read BT-130 from Line.Unit, falling back to Item.Unit. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
alvarolivie
force-pushed
the
items-price-base-qty
branch
from
June 30, 2026 09:58
874b926 to
8b377c2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the item price base quantity and a line-level unit of measure for EN 16931.
Changes
org: base quantity (BT-149) —Item.BaseQuantity, the number of units the item's price refers to (e.g. a price per 100 units). Line sums are calculated asprice × quantity ÷ base_quantity. Validated as positive.bill: invoiced quantity unit (BT-130) —Line.Unit/SubLine.Unit, distinct from the item's price base quantity unit (Item.Unit, BT-150). Core EN 16931 permits the two to differ (e.g. priced per bushel, invoiced in tonnes); only the PEPPOL layer requires them equal.Item.Unit(BT-150), but an item-only unit does not populate the line. Existing documents are byte-for-byte unchanged (no digest churn); divergent units are preserved when set explicitly.examples/gb/invoice-base-quantity.yaml): 250 kg invoiced, priced per 100 kg → sum 300.00.Converter follow-up (gobl.ubl / gobl.cii)
The
@unitCodeon the invoiced quantity (BT-130) is mandatory in both UBL and CII, so the converter mapping is:InvoicedQuantity/@unitCode(UBL) /BilledQuantity/@unitCode(CII) =Line.Unitif set, else fall back toItem.Unit.Price/BaseQuantity/@unitCode(UBL) /BasisQuantity/@unitCode(CII) =Item.Unit, emitted only when a base quantity is present.A future
addons/peppolshould enforcePEPPOL-EN16931-R130(BT-150 == BT-130); core EN 16931 has no such rule.Pre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.And if you are part of the org: