Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 175 additions & 0 deletions uom_preset/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==================
Product UoM Preset
==================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:25e2817b41e423055e70fcc51a6062c9761f32b84cbedd3ef0effe32880a2aed
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcommunity--data--files-lightgray.png?logo=github
:target: https://github.com/OCA/community-data-files/tree/19.0/uom_preset
:alt: OCA/community-data-files
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/community-data-files-19-0/community-data-files-19-0-uom_preset
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/community-data-files&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module ships a registry of named **UoM vocabularies** that
translate supplier-specific unit-of-measure codes into Odoo ``uom.uom``
records, by way of UN/CEFACT Recommendation 20 codes.

The registry is intentionally narrow in scope: it 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_code`` directly via ``uom_unece`` — no preset is needed.

Two vocabularies ship out of the box:

- ``pricat`` — 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`` — 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. Source: *Ariba Network UOM Mapping for ANSI X12* (SAP, 2014).

Additional vocabularies can be contributed as small follow-up modules
that inherit the abstract ``uom.preset`` model and extend its registry.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Usage
=====

This is a developer-facing module — it has no UI of its own.

To resolve a supplier UoM code, call :meth:``uom.preset._resolve``:

.. code:: python

uom = self.env["uom.preset"]._resolve("pricat", "STU")
# -> uom.uom record whose unece_code == "C62", or empty recordset on miss.

Resolution is **strict**: an unknown vocabulary or a code missing from
the chosen vocabulary returns an empty recordset. The caller is expected
to chain its own fallback (typically ``uom_unece`` lookup, then a
default UoM).

To add a new vocabulary, create a small module that depends on
``uom_preset`` and inherits the abstract model:

.. code:: python

from odoo import api, models


class UomPreset(models.AbstractModel):
_inherit = "uom.preset"

@api.model
def _uom_preset_vocabularies(self):
vocabularies = super()._uom_preset_vocabularies()
vocabularies["my_vocab"] = {
"<supplier-code>": "<unece-code>",
# ...
}
return vocabularies

@api.model
def _uom_preset_selection(self):
selection = super()._uom_preset_selection()
selection.append(("my_vocab", self.env._("My supplier vocabulary")))
return selection

Vocabulary keys are uppercased before lookup, so it doesn't matter how
the supplier sends them.

Changelog
=========

19.0.1.0.0 (2026-05-12)
-----------------------

- Initial release. Ships the abstract ``uom.preset`` model with two
vocabularies:

- ``pricat`` (Dutch B2B), sourced from INDI's public OCI-PunchOut
documentation.
- ``x12_355`` (ANSI ASC X12 element 355, US retail/manufacturing EDI),
sourced from the public Ariba Network ANSI X12 ↔ UNUOM mapping (SAP,
2014).

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/community-data-files/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/community-data-files/issues/new?body=module:%20uom_preset%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Bosd

Contributors
------------

- Bosd

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-bosd| image:: https://github.com/bosd.png?size=40px
:target: https://github.com/bosd
:alt: bosd

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-bosd|

This module is part of the `OCA/community-data-files <https://github.com/OCA/community-data-files/tree/19.0/uom_preset>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions uom_preset/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions uom_preset/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2026 Bosd
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Product UoM Preset",
"version": "19.0.1.0.0",
"category": "Product",
"license": "AGPL-3",
"development_status": "Alpha",
"summary": "Translate supplier-specific UoM codes via named vocabularies",
"author": "Bosd, Odoo Community Association (OCA)",
"maintainers": ["bosd"],
"website": "https://github.com/OCA/community-data-files",
"depends": ["uom_unece"],
"data": [],
"installable": True,
}
1 change: 1 addition & 0 deletions uom_preset/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import uom_preset
Loading
Loading