Skip to main content

Search any item by it barcode

Project description

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

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 smashing it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • GRAP

Contributors

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page