Metadata-Version: 2.1
Name: odoo-addon-barcode_gs1_stock
Version: 18.0.1.0.0.2
Requires-Python: >=3.10
Requires-Dist: odoo-addon-barcode_gs1==18.0.*
Requires-Dist: odoo-addon-barcode_stock==18.0.*
Requires-Dist: odoo==18.0.*
Summary: Use the measure on a GS1 label as the quantity picked
Home-page: https://github.com/OCA/barcode-interface
License: AGPL-3
Author: Binhex, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Description-Content-Type: text/x-rst

.. 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:8dd96ec699c9764647906c513948bc18db9fcc581f6c676306450d76480d8452
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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