[19.0][ADD] uom_preset#275
Open
bosd wants to merge 1 commit into
Open
Conversation
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.
Summary
Adds
uom_preset, an abstract-model registry that translates supplier-specific UoM codes to UN/CEFACT Recommendation 20 codes (viauom_unece), so they resolve touom.uomrecords.The module is intentionally narrow in scope: it only covers nomenclatures that do not use UN/CEFACT codes natively. For SCSN-style or any other Rec 20-conformant supplier flow, callers should look up
uom.uom.unece_codedirectly viauom_unece— no preset is needed.Vocabularies shipped
pricat(11 entries) — the Dutch Pricat catalogue/order exchange format, sourced verbatim from INDI's public OCI-PunchOut documentation: https://www.indi.nl/nl-nl/slim-inkopen/erp-connecties/oci-punchout — section Eenheden-overzicht.x12_355(160 entries) — ANSI ASC X12 element 355, used in US retail and manufacturing EDI. Only the entries where the X12 code differs from the UN/CEFACT Rec 20 code are shipped; pass-through entries are dropped so callers fall through touom_unecedirectly. Source: Ariba Network UOM Mapping for ANSI X12 (SAP, 2014, PDF).API
Resolution is strict: an unknown vocabulary or a code missing from the chosen vocabulary returns an empty recordset. The caller chains its own fallback.
To add a vocabulary in a follow-up module, inherit
uom.presetand extend_uom_preset_vocabularies/_uom_preset_selection(see USAGE).Tests
16 cases including a guard that fails if anyone adds a pass-through entry to either dict (catches the "this vocab is just
uom_uneceagain" mistake before review).