Skip to content
Merged
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
169 changes: 169 additions & 0 deletions barcode_gs1_stock/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=================
Barcode GS1 Stock
=================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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%2Fbarcode--interface-lightgray.png?logo=github
:target: https://github.com/OCA/barcode-interface/tree/18.0/barcode_gs1_stock
:alt: OCA/barcode-interface
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/barcode-interface-18-0/barcode-interface-18-0-barcode_gs1_stock
: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/barcode-interface&target_branch=18.0
:alt: Try me on Runboat

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

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**

.. contents::
:local:

Configuration
=============

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.

Usage
=====

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).

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/barcode-interface/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/barcode-interface/issues/new?body=module:%20barcode_gs1_stock%0Aversion:%2018.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
-------

* Binhex

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

- `Antonio David Ruban Espinal <https://github.com/antoniodavid>`__
- `Zuzanna Elzbieta Szalaty
Szalaty <https://github.com/szalatyzuzanna>`__

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-szalatyzuzanna| image:: https://github.com/szalatyzuzanna.png?size=40px
:target: https://github.com/szalatyzuzanna
:alt: szalatyzuzanna

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

|maintainer-szalatyzuzanna|

This module is part of the `OCA/barcode-interface <https://github.com/OCA/barcode-interface/tree/18.0/barcode_gs1_stock>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions barcode_gs1_stock/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# barcode_gs1_stock has no Python models; it teaches the warehouse app how to
# read the quantity off a GS1 label from the frontend assets.
24 changes: 24 additions & 0 deletions barcode_gs1_stock/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "Barcode GS1 Stock",
"version": "18.0.1.0.0",
"category": "Inventory/Logistics",
"summary": "Use the measure on a GS1 label as the quantity picked",
"author": "Binhex, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/barcode-interface",
"maintainers": ["szalatyzuzanna"],
"license": "AGPL-3",
"depends": [
"barcode_gs1",
"barcode_stock",
],
"assets": {
"web.assets_backend": [
"barcode_gs1_stock/static/src/js/gs1_stock_quantity.esm.js",
],
"web.assets_unit_tests": [
"barcode_gs1_stock/static/tests/**/*",
],
},
"installable": True,
"auto_install": True,
}
3 changes: 3 additions & 0 deletions barcode_gs1_stock/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
19 changes: 19 additions & 0 deletions barcode_gs1_stock/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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.
2 changes: 2 additions & 0 deletions barcode_gs1_stock/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* [Antonio David Ruban Espinal](https://github.com/antoniodavid)
* [Zuzanna Elzbieta Szalaty Szalaty](https://github.com/szalatyzuzanna)
11 changes: 11 additions & 0 deletions barcode_gs1_stock/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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.
36 changes: 36 additions & 0 deletions barcode_gs1_stock/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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).
Binary file added barcode_gs1_stock/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading