Barcode GS1 Stock

This module is the bridge between GS1 barcodes and the warehouse
app: it makes the measure a GS1 label carries the quantity picked,
expressed in the unit the product is stocked in.
A GS1 label often states both, and they disagree: a box of cured meat
carries “2 pieces” (AI 30) and “2.497 kg” (AI 310n). Which of the two is
the quantity depends on how the product is stocked, something only the
warehouse knows — kilograms make it the weight, units make it the count.
It installs itself as soon as both barcode_gs1 and barcode_stock
are installed, and neither needs the other without it.
Table of contents
Nothing to configure for the module itself. The precision a measure is
kept at is Odoo’s, though, and its defaults are coarser than most GS1
labels.
A measure becomes a quantity rounded twice, as anywhere in stock: to the
Rounding Precision of the product’s unit, and to the decimals of the
Product Unit of Measure accuracy. Both default to two decimals, so the
2.497 kg a label states is stored as 2.50 kg, and the app shows 2.50 so
that the quantity on screen is the one that will be stored.
To keep the grams a label states, for products stocked in kilograms:
- set the Rounding Precision of kg to 0.001, under Inventory →
Configuration → Units of Measures → UoM Categories → Weight (the
Units of Measure option must be enabled in the Inventory settings);
- set the digits of Product Unit of Measure to 3, under Settings →
Technical → Database Structure → Decimal Accuracy (developer mode).
The accuracy applies to every quantity in the database, not only to
scans.
Installing barcode_gs1 next to barcode_stock brings this module
in, and every screen that applies a scanned quantity uses it.
When a scanned GS1 barcode carries a measure, the unit that measure is
in comes from the rule that read it (Unit of Measure on the barcode
rule — AI 310n is kilograms, 320n pounds, 311n metres). It is then
compared with the unit the product is stocked in:
- same kind of unit — the measure is the quantity, converted into
the product’s own unit: 2.497 kg on the label is 2497 for a product in
grams;
- a different kind — a weight for a product counted in units, say —
the measure says nothing about how many to pick, so the piece count on
the label (AI 30/37) is the quantity, and a single unit when the label
states none.
When a label states several measures (a net weight and a net volume,
say), the first one in the product’s kind of unit is taken. The gross
weight and the other measures of the pack itself (AI 330n–349n) never
are.
The quantity is rounded the way it will be stored, so what the screen
shows is what ends up in stock. With Odoo’s defaults that is two
decimals: 2.497 kg is 2.50 for a product in kilograms (see Configuration
to keep the grams). A measure that rounds to nothing (4 g, for a product
in kilograms kept to two decimals) is not taken: the scan reads as one
without a measure.
When the GTIN is a packaging barcode (a carton of twelve, say), a label
without a count picks the pack’s quantity, and a count on the label wins
over it. A measure in the product’s own kind of unit wins over both: a
carton of cheese weighing 4.32 kg is 4.32 for a product stocked in
kilograms, not twelve.
The units of measure are read when the app opens. Should that fail, they
are read again on the next scan that carries a measure; that one scan
reads as if it carried none.
Without this module GS1 barcodes are still parsed, but a measure is
never the quantity: the warehouse app takes the piece count, or a single
unit (the pack’s quantity for a packaging barcode).
Bugs are tracked on GitHub 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.
Do not contact contributors directly about support or help with technical issues.
This module is maintained by the OCA.
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.
Current maintainer:

This module is part of the OCA/barcode-interface project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.