When a product has a valid EAN barcode, we would like to include the qty
of the product + its uom in its GS1 datamatrix (dm). There are a lot of
hardcoded values in report in order to fit GS1 standard:
- GS1 UoM codes are ALWAYS 3 digits (to indicate which UoM) + 1 digit
(to indicate number of digits) EXCEPT for Units UoM. Because we cannot
update a dict in QWeb, we check for both whether it's a supported GS1
UoM or a Unit separately rather than 1 general check.
- We hardcode the GS1 units value as '30' in this case (there are 2
options) because the code is specific to qty of a product (not qty of
product within a SSCC GS1 dm, there is a different value for that).
There are some limitations to this implementation due to
incompatibilities between Odoo + GS1, specifically:
- some Odoo UoMs are not included as GS1 UoMs => won't be included in dm
- # of Odoo quantity digits can exceed the number of digits allowed in
GS1 (8 digits for Units, 6 digits for all other UoMs, including
decimal values from rounding precision, e.g. 1 cm with rounding
precision 0.000001 has 7 digits as 1.000000) => won't be included in
dm in this case
- Odoo treats "fl oz" (Volume) and "oz" (Weight) as separate UoMs but
GS1 does not => we only handle weight for now
- Odoo supports non-integer values for Unit UoM but GS1 does not => we
round quantity to an integer value.
Note that implementation includes flexibility for users so they can
add/remove UoMs from the GS1 nomenclature rules as wanted/needed. This
includes user created custom codes (e.g. 90, 92-99 + extra character -
code isn't required to start with these numbers, but it won't be GS1
compliant) to handle UoMs not included in GS1 specifications as long as
they are correctly configured as quantities if user wants to be able to
rescan quantities back in with barcode app and match the 6 digits or
less quantitiy requirement when printing.
Part of Task: 2494740
Related ENT PR: odoo/enterprise#23323
Part-of: odoo/odoo#82389