Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18.0 mig barcode action #1006

Open
wants to merge 53 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
e8f6383
[ADD] barcodes_action
etobella Jul 4, 2018
b9f50e4
implement an actual running example
JordiBForgeFlow Jul 4, 2018
8540dad
[IMP] barcode_action: Add tests
etobella Jul 4, 2018
ec4aab4
[UPD] Update barcode_action.pot
oca-travis Aug 8, 2018
4eff417
[UPD] README.rst
OCA-git-bot Aug 9, 2018
54390b6
[UPD] README.rst
OCA-git-bot Aug 24, 2018
b9d85a0
Added translation using Weblate (Spanish)
etobella May 8, 2019
1379f4d
Translated using Weblate (Spanish)
etobella May 8, 2019
25adfe9
[12.0][MIG] barcode_action
Jun 12, 2019
97b3476
[UPD] Update barcode_action.pot
oca-travis Jul 1, 2019
e25fbff
Update translation files
oca-transbot Jul 20, 2019
1844d4b
[UPD] README.rst
OCA-git-bot Jul 29, 2019
0f15e23
Added translation using Weblate (Portuguese)
pedrocs-exo Aug 14, 2019
915108c
Translated using Weblate (Portuguese)
pedrocs-exo Aug 14, 2019
0ce8236
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Sep 2, 2019
6968626
Translated using Weblate (Chinese (Simplified))
liweijie0812 Sep 2, 2019
26bc3fd
Added translation using Weblate (Croatian)
badbole Dec 4, 2019
e538eb0
Translated using Weblate (Croatian)
badbole Dec 4, 2019
7c12cc7
[IMP] barcode_action: black, isort
AdriaGForgeFlow Mar 9, 2020
f212013
[13.0][MIG] barcode_action
AdriaGForgeFlow Mar 9, 2020
140dddd
[UPD] Update barcode_action.pot
oca-travis Mar 12, 2020
09f472e
Update translation files
oca-transbot Mar 17, 2020
a6c757c
pre-commit update
sbidoul Apr 22, 2020
6e0d82a
[IMP] barcode_action: black, isort, prettier
Tardo May 13, 2020
26250e5
Update translation files
oca-transbot Aug 16, 2020
3213602
[IMP] barcode_action: isort, black, prettier.
fshah-initos Feb 26, 2021
83caee1
[MIG] Migrate module barcode_action to v14.
fshah-initos Feb 26, 2021
6059f2e
[UPD] Update barcode_action.pot
oca-travis Mar 1, 2021
88e3ea5
[UPD] README.rst
OCA-git-bot Mar 1, 2021
c226373
Translated using Weblate (Spanish)
anasuarez1 Mar 16, 2021
a5c34c4
Translated using Weblate (Portuguese)
pedrocs-exo Jul 2, 2021
ef40554
[FIX] Fix access right issues when using actions
sebalix Jan 31, 2022
e666211
barcode_action 14.0.1.0.1
OCA-git-bot Feb 2, 2022
76f8c03
[MIG] barcode_action: Migration to 15.0
JasminSForgeFlow Feb 4, 2022
a9f6241
[UPD] Update barcode_action.pot
Feb 7, 2022
31db192
[UPD] README.rst
OCA-git-bot Feb 7, 2022
b61bffb
[IMP] barcode_action: pre-commit stuff
dsolanki-initos Apr 25, 2023
b1772a3
[MIG] barcode_action: Migration to 16.0
dsolanki-initos Apr 25, 2023
6ceacf5
[UPD] Update barcode_action.pot
Dec 2, 2023
53a2fc6
[BOT] post-merge updates
OCA-git-bot Dec 2, 2023
d965740
Update translation files
weblate Dec 2, 2023
4af400d
Update translation files
weblate Dec 2, 2023
7e94005
Translated using Weblate (Spanish)
Ivorra78 Dec 7, 2023
7be582b
Added translation using Weblate (Italian)
mymage Dec 28, 2023
d86226a
Translated using Weblate (Italian)
mymage Jan 2, 2024
2db38c7
[IMP] barcode_action: pre-commit auto fixes
mpascuall Apr 24, 2024
c59fbc6
[MIG] barcode_action: Migration to 17.0
mpascuall Apr 25, 2024
d8f87f9
[UPD] Update barcode_action.pot
Sep 9, 2024
d79bc05
[BOT] post-merge updates
OCA-git-bot Sep 9, 2024
2cd0ba5
Update translation files
weblate Sep 9, 2024
63a1cb3
Translated using Weblate (Italian)
mymage Sep 18, 2024
95f353e
[MIG] barcode_action: Migration to 18.0
jmartinacu Jan 27, 2025
a4358ad
[MIG] barcode_action: Imported rpc util from '@web/core/network/rpc' …
jmartinacu Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 152 additions & 0 deletions barcode_action/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
=======================
Barcode action launcher
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:87fc995f6dec3e033f207c35131f848aaf3987733def7d2e096696664e9c93df
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github
:target: https://github.com/OCA/server-ux/tree/17.0/barcode_action
:alt: OCA/server-ux
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-ux-17-0/server-ux-17-0-barcode_action
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-ux&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

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**

.. contents::
:local:

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 <https://github.com/OCA/server-ux/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 <https://github.com/OCA/server-ux/issues/new?body=module:%20barcode_action%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Creu Blanca
* ForgeFlow

Contributors
------------

- Enric Tobella <etobella@creublanca.es>
- Jordi Ballester <jordi.ballester@forgeflow.com>
- Foram Shah <foram.shah@initos.com>
- Dhara Solanki <dhara.solanki@initos.com>
- `APSL <https://apsl.tech>`__:

- Miquel Pascual <mpascual@apsl.net>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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 <https://github.com/OCA/server-ux/tree/17.0/barcode_action>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions barcode_action/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import wizard
from . import models
26 changes: 26 additions & 0 deletions barcode_action/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2017 Creu Blanca
# Copyright 2020 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

{
"name": "Barcode action launcher",
"version": "18.0.1.0.0",
"category": "Extra Tools",
"website": "https://github.com/OCA/server-ux",
"author": "Creu Blanca, ForgeFlow, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"application": False,
"summary": "Allows to use barcodes as a launcher",
"depends": ["barcodes"],
"data": [
"security/ir.model.access.csv",
"wizard/barcode_action_view.xml",
],
"assets": {
"web.assets_backend": [
"barcode_action/static/src/js/action_barcode_widget.esm.js",
],
},
"demo": ["demo/barcode_action_demo.xml"],
}
20 changes: 20 additions & 0 deletions barcode_action/demo/barcode_action_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="res_partner_find" model="ir.actions.act_window">
<field name="name">Find Partner</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">barcode.action</field>
<field name="view_mode">form</field>
<field
name="context"
>{'default_model': 'res.partner', 'default_method': 'find_res_partner_by_ref_using_barcode'}
</field>
<field name="target">new</field>
</record>
<menuitem
id="menu_orders_customers"
name="Find partners"
action="res_partner_find"
parent="base.menu_administration"
/>
</odoo>
131 changes: 131 additions & 0 deletions barcode_action/i18n/barcode_action.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * barcode_action
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: barcode_action
#: model:ir.model,name:barcode_action.model_barcode_action
msgid "Barcode Action"
msgstr ""

#. module: barcode_action
#: model:ir.actions.act_window,name:barcode_action.barcode_action_action
msgid "Barcode Launcher"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action___barcode_scanned
msgid "Barcode Scanned"
msgstr ""

#. module: barcode_action
#: model_terms:ir.ui.view,arch_db:barcode_action.barcode_action_form
msgid "Close"
msgstr ""

#. module: barcode_action
#: model:ir.model,name:barcode_action.model_res_partner
msgid "Contact"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__create_uid
msgid "Created by"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__create_date
msgid "Created on"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__display_name
msgid "Display Name"
msgstr ""

#. module: barcode_action
#: model_terms:ir.ui.view,arch_db:barcode_action.barcode_action_form
msgid "Find"
msgstr ""

#. module: barcode_action
#: model:ir.actions.act_window,name:barcode_action.res_partner_find
msgid "Find Partner"
msgstr ""

#. module: barcode_action
#: model:ir.ui.menu,name:barcode_action.menu_orders_customers
msgid "Find partners"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__id
msgid "ID"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__write_uid
msgid "Last Updated by"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__write_date
msgid "Last Updated on"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__method
msgid "Method"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__model
msgid "Model"
msgstr ""

#. module: barcode_action
#. odoo-python
#: code:addons/barcode_action/models/res_partner.py:0
#, python-format
msgid "Partner with Internal Reference %s cannot be found"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__res_id
msgid "Res"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__state
msgid "State"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,field_description:barcode_action.field_barcode_action__status
msgid "Status"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields,help:barcode_action.field_barcode_action___barcode_scanned
msgid "Value of the last barcode scanned."
msgstr ""

#. module: barcode_action
#: model:ir.model.fields.selection,name:barcode_action.selection__barcode_action__state__waiting
msgid "Waiting"
msgstr ""

#. module: barcode_action
#: model:ir.model.fields.selection,name:barcode_action.selection__barcode_action__state__warning
msgid "Warning"
msgstr ""
Loading
Loading