Skip to main content

Allows to use barcodes as a launcher

Project description

Beta License: AGPL-3 OCA/server-ux Translate me on Weblate Try me on Runbot

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.

Table of contents


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:


<act_window id="res_partner_find"
    name="Find Partner"
    context="{'default_model': 'res.partner', 'default_method': 'find_res_partner_by_ref_using_barcode'}"

<menuitem id="menu_orders_customers" name="Find partners"

Python code:

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

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

    def find_res_partner_by_ref_using_barcode(self, barcode):
        partner =[('ref', '=', barcode)], limit=1)
        if not partner:
            action = self.env.ref('res_partner_find')
            result =[0]
            context = safe_eval(result['context'])
                '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 =[0]
        res = self.env.ref('base.view_partner_form', False)
        result['views'] = [(res and or False, 'form')]
        result['res_id'] =
        return result

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.



  • Creu Blanca

  • ForgeFlow



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

You are welcome to contribute. To learn how please visit

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 Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page