Search By Barcode

Search any item by it barcode

https://odoo-community.org/web/image/product.template/5501/image_1920?unique=a5e1c38
  • Odoo Version

Terms and Conditions 

Search By Barcode

Beta License: AGPL-3 OCA/stock-logistics-barcode Translate me on Weblate Try me on Runboat

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

Table of contents

Usage

  • In the main menu click on the barcode new button
New icon in Odoo Top Menu
  • In the pop up form, enter the barcode and click on the search button
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.
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.

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:

result = self.env['barcode.search'].search_by_barcode('12345567890123')
@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. 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.

Credits

Authors

  • GRAP

Maintainers

This module is maintained by the OCA.

Odoo Community Association

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 project on GitHub.

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

This is a preview of the recently viewed products by the user.
Once the user has seen at least one product this snippet will be visible.

Recently viewed Products