Odoo Community Association

Barcode Scanner

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

This module is the base framework of the Barcode suite: a fast, full-screen scanning application shell for Odoo that other modules extend.

It ships no business logic of its own. Instead it exposes the building blocks feature modules plug into, the same way Odoo widgets self-register:

Install a feature module on top — such as barcode_stock — to get actual warehouse operations.

Table of contents

Usage

barcode_scanner is a framework and is not useful on its own: install a feature module such as barcode_stock to get actual operations.

To build your own feature module, register your pieces into the framework registries — no change to the base module is required.

Register a screen:

import {barcodeScreens} from "@barcode_scanner/js/registries";

barcodeScreens.add("my_screen", {component: MyScreen});

Register a scan handler (tried in sequence order; the first that returns a truthy value consumes the scan):

import {barcodeScanHandlers} from "@barcode_scanner/js/registries";

barcodeScanHandlers.add("my_handler", {
    async handle(barcode, parsed, {api, navigate, notify}) {
        // return true when handled
    },
}, {sequence: 50});

Register a home-screen tile:

import {barcodeMenuTiles} from "@barcode_scanner/js/registries";

barcodeMenuTiles.add("my_tile", {
    label: "My Screen",
    icon: "fa-cube",
    action: ({navigate}) => navigate("my_screen"),
}, {sequence: 50});

Register a barcode parser (tried in sequence order before the built-in EAN13 one; return null to let the next parser try):

import {barcodeParsers} from "@barcode_scanner/js/registries";

barcodeParsers.add("my_symbology", (barcode) => {
    // return {type: "...", value: "<product code>", ...} or null
}, {sequence: 20});

Register a startup task, for data your module needs before the first scan (barcode_gs1 reads its nomenclature this way). Tasks are awaited when the app opens; one that fails is logged and skipped:

import {barcodeStartupTasks} from "@barcode_scanner/js/registries";

barcodeStartupTasks.add("my_config", (env) => loadMyConfig(env.services.orm));

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

  • Binhex

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.

Current maintainer:

szalatyzuzanna

This module is part of the OCA/barcode-interface project on GitHub.

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