OdooWiki OCA HUB

Barcode action launcher

barcode_action folder_open OCA/server-ux open_in_new
Extra Tools License: AGPL-3

This module allows to use barcodes as launchers of actions.

The action will launch a function that uses the barcode in order to return an action.

auto_awesome What this module does

AI-generated from the code · Odoo 19.0

Lets users scan a barcode to trigger an action in Odoo, such as opening the partner whose Internal Reference matches the scanned code. A demo menu "Find partners" is provided.

This module turns barcodes into action launchers. It adds a small pop-up screen (the barcode.action wizard) that waits for a barcode scan and then calls a function on a chosen model, using the scanned code as input. The function returns an Odoo action, which is opened automatically.

Where it appears: - A demo menu "Find partners" under Administration opens the barcode launcher for partners. - The wizard shows a green message while waiting for a scan and a red warning message when something goes wrong (for example, no partner found).

Business behaviour shown in the code: - The partner model gains a method that searches for a partner by its Internal Reference (ref) equal to the scanned barcode. - If a partner is found, Odoo opens that partner's form. - If no partner matches, a warning pop-up is shown saying the partner with that Internal Reference cannot be found.

The module depends on the standard barcodes app and adds a barcode handler field used in the wizard form. It also defines a barcode.action model with fields for the target model, record id, method, state and status message. Access is granted to all internal users. No scheduled jobs, emails or reports are added.

Depends on

barcodes

Menus it adds

Find partners
Models and fields (2)
  • res.partner · extends an existing model
  • barcode.action · new modelmodel, state, method, res_id, status

Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 8 confirmed, 1 with no information of 9 versions.

Sources · Odoo 18.0

Confirmed on 2026-11-03 in branch 18.0 of OCA/server-ux.

terminal Installation and usage

OCA documentation · Odoo 19.0

Actions must be configured with the following data in the context: * model: Model where we can find the method (required) * method: Method to execute (required) * res_id: Id as base (optional)

The method must return an action. Installing this module with demo data will install a demo application that allows the system administrator to find a partner by the external reference encoded in a barcode.

Go to Settings / Find partners and scan a barcode that contains the internal reference of an existing partner. As soon as you read the barcode the system will redirect you to that partner's form view.

Technical implementation of this example:

Action:

Python code:

import json from odoo import api, models, _ from odoo.tools.safe_eval import safe_eval

class ResPartner(models.Model): _inherit = 'res.partner'

@api.multi def find_res_partner_by_ref_using_barcode(self, barcode): partner = self.search([('ref', '=', barcode)], limit=1) if not partner: action = self.env.ref('res_partner_find') result = action.read()[0] context = safe_eval(result['context']) context.update({ 'default_state': 'warning', 'default_status': _('Partner with Internal Reference ' '%s cannot be found') % barcode }) result['context'] = json.dumps(context) return result action = self.env.ref('base.action_partner_form') result = action.read()[0] res = self.env.ref('base.view_partner_form', False) result['views'] = [(res and res.id or False, 'form')] result['res_id'] = partner.id return result

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.