Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Barcode action launcher

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

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

Usage

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:

<act_window id="res_partner_find"
    name="Find Partner"
    res_model="barcode.action"
    view_mode="form"
    view_type="form"
    context="{'default_model': 'res.partner', 'default_method': 'find_res_partner_by_ref_using_barcode'}"
    target="new"/>

<menuitem id="menu_orders_customers" name="Find partners"
    action="res_partner_find"
    parent="base.menu_administration"/>

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

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

  • Creu Blanca

  • Eficent

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

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

Metadata

Release files for odoo12-addon-barcode-action 12.0.1.0.0.99.dev12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo12-addon-barcode-action 12.0.1.0.0.99.dev12
File Interpreter ABI Platform Actions
odoo12_addon_barcode_action-12.0.1.0.0.99.dev12-py3-none-any.whl Python 3 none any Details for odoo12_addon_barcode_action-12.0.1.0.0.99.dev12-py3-none-any.whl

Release files / odoo12_addon_barcode_action-12.0.1.0.0.99.dev12-py3-none-any.whl

Download URL odoo12_addon_barcode_action-12.0.1.0.0.99.dev12-py3-none-any.whl
Size 34.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fcda3b781c7b7d8a1d5590513cfe534d011056310ab7f00c3971ce8b7c1c227c
BLAKE2b-256 checksum
How to use checksums
97d5c46e822f627c124b1198cd894ca4f190adb0706feb6d0425f7d87e781c5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Security for odoo12-addon-barcode-action 12.0.1.0.0.99.dev12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page