forked from OCA/stock-logistics-barcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create new module 'barcodes_generator_abstract
- Loading branch information
1 parent
ffd5cdb
commit ff8212c
Showing
15 changed files
with
558 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
=========================================== | ||
Generate Barcodes for any Models (Abstract) | ||
=========================================== | ||
|
||
This module expends Odoo functionnality, allowing user to generate barcode | ||
depending on a given barcode rule for any Model. | ||
|
||
For exemple, a typical pattern for products is "20.....{NNNDD}" that means | ||
that: | ||
* the EAN13 code will begin by '20' | ||
* followed by 5 digits (named Barcode Base in this module) | ||
* and after 5 others digits to define the variable price | ||
* a 13 digit control | ||
|
||
With this module, it is possible to: | ||
|
||
* Affect a pattern (barcode.rule) to a model | ||
|
||
* Define a Barcode base: | ||
* manually, if the base of the barcode must be set by a user. (typically an | ||
internal code defined in your company) | ||
* automaticaly by a sequence, if you want to let Odoo to increment a | ||
sequence. (typical case of a customer number incrementation) | ||
|
||
* Generate a barcode, based on the defined pattern and the barcode base | ||
|
||
Installation | ||
============ | ||
|
||
This module use an extra python librairy named 'pyBarcode' you should install | ||
to make barcode generation works properly. | ||
|
||
sudo pip install pyBarcode | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
* Go to XXX / Configuration / Barcode Nomenclatures and select | ||
* Select a Nomenclature | ||
* Create or select a rule | ||
|
||
.. image:: /barcodes_generator_abstract/static/description/barcode_rule_tree.png | ||
|
||
* For manual generation, set: | ||
* 'Base set Manually' in 'Generate Type' | ||
* Set the model | ||
|
||
.. image:: /barcodes_generator_abstract/static/description/barcode_rule_form_manual.png | ||
|
||
* For automatic generation, set: | ||
* 'Base managed by Sequence' in 'Generate Type' | ||
* Set the model | ||
* Generate a new sequence by button, or affect a existing one | ||
|
||
.. image:: /barcodes_generator_abstract/static/description/barcode_rule_form_sequence.png | ||
|
||
In all cases, padding will be computed automaticaly, based on the number | ||
of '.' in the Barcode Pattern field. | ||
|
||
Usage | ||
===== | ||
|
||
This module is an abstract module. You can configure Barcode Rule, but to | ||
enable this feature, you need to install an extra module for a given model. | ||
This repository provide 'barcodes_generator_product' and | ||
'barcodes_generator_partner' module to generate barcode for product or partner | ||
model. | ||
|
||
Alternatively, you can develop a custom module for a custom model. See | ||
'Inheritance' parts. | ||
|
||
Try this module on Runbot | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/184/9.0 | ||
|
||
Inheritance | ||
=========== | ||
|
||
If you want to generate barcode for another model, you can create a custom | ||
module that inherits on 'barcodes_generator_abstract' and inherit your model | ||
like that: | ||
|
||
class MyModel(models.Model): | ||
_name = 'my.model' | ||
_inherit = ['my.model', 'barcode.generate.mixin'] | ||
|
||
class barcode_rule(models.Model): | ||
_inherit = 'barcode.rule' | ||
|
||
generate_model = fields.Selection(selection_add=[('my.model', 'My Model')]) | ||
|
||
Finally, you should inherit your model view adding buttons and fields. | ||
|
||
Note | ||
---- | ||
|
||
Your model should have a field 'barcode' defined. | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
1. On barcode.rule model, constraint and domain system could be set between | ||
'type' and 'generate_model' fields. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/stock-logistics-barcode/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. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Icon of the module is based on the Oxygen Team work and is under LGPL licence: | ||
http://www.iconarchive.com/show/oxygen-icons-by-oxygen-icons.org.html | ||
|
||
Contributors | ||
------------ | ||
|
||
* Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
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. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2014-Today GRAP (http://www.grap.coop) | ||
# Copyright (C) 2016-Today La Louve (http://www.lalouve.net) | ||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
'name': 'Generate Barcodes (Abstract)', | ||
'summary': 'Generate Barcodes for Any Models', | ||
'version': '9.0.1.0.0', | ||
'category': 'Point Of Sale', | ||
'author': | ||
'GRAP,' | ||
'La Louve,' | ||
'Odoo Community Association (OCA)', | ||
'website': 'http://www.odoo-community.org', | ||
'license': 'AGPL-3', | ||
'depends': [ | ||
'barcodes', | ||
], | ||
'data': [ | ||
'security/res_groups.xml', | ||
'views/view_barcode_rule.xml', | ||
'views/menu.xml', | ||
], | ||
'demo': [ | ||
'demo/res_users.xml', | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2016-Today: GRAP (http://www.grap.coop) | ||
Copyright (C) 2016-Today La Louve (http://www.lalouve.net) | ||
@author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
--> | ||
|
||
<odoo> | ||
|
||
<record id="base.user_root" model="res.users"> | ||
<field name="groups_id" eval="[ | ||
(4, ref('barcodes_generator_abstract.generate_barcode')), | ||
]" /> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * barcodes_generator_abstract | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 9.0c\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-11-08 10:26+0000\n" | ||
"PO-Revision-Date: 2016-11-08 10:26+0000\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: barcodes_generator_abstract | ||
#: model:ir.model.fields,help:barcodes_generator_abstract.field_barcode_generate_mixin_generate_type | ||
#: model:ir.model.fields,help:barcodes_generator_abstract.field_barcode_rule_generate_type | ||
msgid "Allow to generate barcode, including a number (a base) in the final barcode.\n" | ||
" 'Base Set Manually' : User should set manually the value of the barcode base\n" | ||
" 'Base managed by Sequence': User will use a button to generate a new base. This base will be generated by a sequence" | ||
msgstr "Autorise à générer des codes barre en incluant un numéro (base du code barre) dans le code barre final.\n" | ||
" 'Base indiquée manuellement' : L'utilisateur devra indiquer manuellement la base du barcode\n" | ||
" 'Base gérée via une séquence': L'utilisateur devra utiliser un boutton pour générer une nouvelle base. Cette base sera générée par une séquence" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model.fields,field_description:barcodes_generator_abstract.field_barcode_generate_mixin_barcode_base | ||
msgid "Barcode Base" | ||
msgstr "Base du code Barre" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.ui.view,arch_db:barcodes_generator_abstract.view_barcode_rule_form | ||
msgid "Barcode Generation" | ||
msgstr "Génération d'un code barre" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model.fields,field_description:barcodes_generator_abstract.field_barcode_generate_mixin_barcode_rule_id | ||
msgid "Barcode Rule" | ||
msgstr "Règle de code barre" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: selection:barcode.rule,generate_type:0 | ||
msgid "Base managed by Sequence" | ||
msgstr "Base gérée via une séquence" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: selection:barcode.rule,generate_type:0 | ||
msgid "Base set Manually" | ||
msgstr "Base indiquée manuellement" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model.fields,field_description:barcodes_generator_abstract.field_barcode_generate_mixin_display_name | ||
msgid "Display Name" | ||
msgstr "Nom affiché" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:res.groups,name:barcodes_generator_abstract.generate_barcode | ||
msgid "Generate Barcodes" | ||
msgstr "Générer des codes barre" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: code:addons/barcodes_generator_abstract/models/barcode_generate_mixin.py:40 | ||
#, python-format | ||
msgid "Generate Base can be used only with barcode rule with 'Generate Type' set to 'Base managed by Sequence'" | ||
msgstr "Générer une base de code barre peut être utilisée seulement si la règle de code barre est de type 'gérée via une séquence'" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model.fields,field_description:barcodes_generator_abstract.field_barcode_rule_generate_model | ||
msgid "Generate Model" | ||
msgstr "Modèle" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.ui.view,arch_db:barcodes_generator_abstract.view_barcode_rule_form | ||
msgid "Generate Sequence" | ||
msgstr "Séquence" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: code:addons/barcodes_generator_abstract/models/barcode_rule.py:68 | ||
#, python-format | ||
msgid "Generate Sequence is possible only if 'Generate Type' is set to 'Base managed by Sequence'" | ||
msgstr "Générer une séquence possible seulement si le type de génération est définie à 'Gérée via une séquence'" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model.fields,field_description:barcodes_generator_abstract.field_barcode_generate_mixin_generate_type | ||
#: model:ir.model.fields,field_description:barcodes_generator_abstract.field_barcode_rule_generate_type | ||
msgid "Generate Type" | ||
msgstr "Type de génération" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model.fields,field_description:barcodes_generator_abstract.field_barcode_generate_mixin_id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model.fields,field_description:barcodes_generator_abstract.field_barcode_generate_mixin___last_update | ||
msgid "Last Modified on" | ||
msgstr "Dernière modification le" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: selection:barcode.rule,generate_type:0 | ||
msgid "No generation" | ||
msgstr "Pas de génération" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model.fields,field_description:barcodes_generator_abstract.field_barcode_rule_padding | ||
msgid "Padding" | ||
msgstr "Taille" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model.fields,field_description:barcodes_generator_abstract.field_barcode_rule_sequence_id | ||
msgid "Sequence" | ||
msgstr "Séquence" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: code:addons/barcodes_generator_abstract/models/barcode_rule.py:78 | ||
#, python-format | ||
msgid "Sequence - %s" | ||
msgstr "Séquence - %s" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model,name:barcodes_generator_abstract.model_barcode_generate_mixin | ||
msgid "barcode.generate.mixin" | ||
msgstr "barcode.generate.mixin" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model,name:barcodes_generator_abstract.model_barcode_rule | ||
msgid "barcode.rule" | ||
msgstr "barcode.rule" | ||
|
||
#. module: barcodes_generator_abstract | ||
#: model:ir.model.fields,help:barcodes_generator_abstract.field_barcode_rule_generate_model | ||
msgid "if 'Generate Type' is set, mention the model related to this rule." | ||
msgstr "Si le type de génération est défini, veuillez indiquer un modèle sur lequel l'appliquer." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
from . import barcode_generate_mixin | ||
|
||
from . import barcode_rule |
Oops, something went wrong.