Metadata-Version: 2.1
Name: odoo10-addon-barcodes-search
Version: 10.0.1.0.2.99.dev2
Summary: Search any item by it barcode
Home-page: https://github.com/OCA/stock-logistics-barcode
Author: GRAP, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
License: AGPL-3
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 10.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Requires-Python: ~=2.7
Requires-Dist: odoo <10.1dev,>=10.0

=================
Search By Barcode
=================

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

.. |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/licence-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%2Fstock--logistics--barcode-lightgray.png?logo=github
    :target: https://github.com/OCA/stock-logistics-barcode/tree/10.0/barcodes_search
    :alt: OCA/stock-logistics-barcode
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/stock-logistics-barcode-10-0/stock-logistics-barcode-10-0-barcodes_search
    :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/stock-logistics-barcode&target_branch=10.0
    :alt: Try me on Runboat

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

This module expends Odoo functionality, allowing user to search any item by
its barcode.

**Table of contents**

.. contents::
   :local:

Usage
=====

* In the main menu click on the barcode new button

.. image:: https://raw.githubusercontent.com/OCA/stock-logistics-barcode/10.0/barcodes_search/static/description/barcode_button_menu.png
   :alt: New icon in Odoo Top Menu


* In the pop up form, enter the barcode and click on the search button

.. image:: https://raw.githubusercontent.com/OCA/stock-logistics-barcode/10.0/barcodes_search/static/description/partner_search.png
   :width: 800 px
   :alt: Partner Search Form

**Case 1: One item found**

If an item is found, the pop up is closed, and the form view of the item is
displayed. (Demo data with ``0419100000009`` to search a partner)

**Case 2: Many items found**

If many items are found, the list of the items are displayed and the user
can go on the according form view by clicking on the button on the end of
the line. This case can occur:

* in a normal case, if a barcode is associated to many models. Two typical
  cases are : product.product / product.template and res.users / res.partner.
  (Demo data with ``3057068106783`` to search a product)

* if the database is corrupted, and a barcode is set to many differents
  items.

.. image:: https://raw.githubusercontent.com/OCA/stock-logistics-barcode/10.0/barcodes_search/static/description/partner_user_search.png
   :width: 800 px
   :alt: Partner and User Result form

**Case 3: Barcode with specific rule**

In some specifics cases when the barcode contains extra data (like price
or weight), the barcode will be different than the product barcode.
In that case, the item is displayed, and the data is analysed.

Exemple : Barcode ``2391000005002`` when:

* ``23`` is a prefix
* ``91000`` is a base code of the product
* ``00500`` is the price
* ``2`` is a control digit

If this barcode is entered, the product with the barcode ``2391000000007`` will
be returned.

.. image:: https://raw.githubusercontent.com/OCA/stock-logistics-barcode/10.0/barcodes_search/static/description/price_product_search.png
   :width: 800 px
   :alt: Price Product Search Form


Development
===========

**Use in other modules**

The search will be done on all the fields named ``barcode`` in any models.

For developers, there are one handy method in ``barcode.search`` as well:

.. code-block:: python

    result = self.env['barcode.search'].search_by_barcode('12345567890123')

.. code-block:: python

    @api.model
    def search_by_barcode(self, barcode):
        """Return the record associated with the barcode.

        Args:
            barcode (str): Barcode string to search for.

        Returns: a tuple (Field, BaseModel, ExtraData)
            Field: a record of the field that matched the search
            BaseModel: A record matching the barcode, if existing
            ExtraData: An optional dictionnary that provides extra informations
        """

**Inheritance**

* If you want to make a search on a field that is not named 'barcode', you
  should overload the function ``get_barcode_fields`` of the model
  ``barcode.search``.

* If you want to implement another integration of extra data in a barcode
  via a rule, you should overload the function
  ``get_model_by_rule_type`` of the model ``barcode.search``.

For the time being, three rule types are handled:

- ``weight``, defined in Odoo ``stock`` module
- ``price``, defined in Odoo ``point_of_sale`` module
- ``price_to_weight``, defined in OCA ``pos_price_to weight`` module

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

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

* GRAP

Contributors
~~~~~~~~~~~~

* Sylvain LE GAL <https://twitter.com/legalsylvain>

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.

This module is part of the `OCA/stock-logistics-barcode <https://github.com/OCA/stock-logistics-barcode/tree/10.0/barcodes_search>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.


