Skip to content

Commit

Permalink
Merge df80e3d into 8bcbafe
Browse files Browse the repository at this point in the history
  • Loading branch information
cvinh committed Aug 26, 2019
2 parents 8bcbafe + df80e3d commit 729054b
Show file tree
Hide file tree
Showing 22 changed files with 923 additions and 0 deletions.
102 changes: 102 additions & 0 deletions barcodes_generator_product/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
.. 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 Products (Templates and Variants)
=======================================================

This module expands Odoo functionality, allowing user to generate barcode
depending on a given barcode rule for Products.

For example, 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:

* Assign a pattern (barcode.rule) to a product.product

* 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

Configuration
=============

To configure this module, see the 'Configuration' Section of the description
of the module 'barcodes_generator_abstract'

Usage
=====

To use this module, you need to:

* Go to a Product form (or a template form):

1 for manual generation
* Set a Barcode Rule
* Set a Barcode Base
* click on the button 'Generate Barcode (Using Barcode Rule)'

.. image:: /barcodes_generator/static/description/product_template_manual_generation.png

2 for automatic generation
* Set a Barcode Rule
* click on the button 'Generate Base (Using Sequence)'
* click on the button 'Generate Barcode (Using Barcode Rule)'


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/150/10.0

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 smash it by providing 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
* Product tag by `Zlatko Najdenovski <https://www.iconfinder.com/zlaten>`_ and is licensed
under `CC BY 3.0 <https://creativecommons.org/licenses/by/3.0/>`_.

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

* Sylvain LE GAL (https://twitter.com/legalsylvain)
* Dave Lasley <dave@laslabs.com>

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.

3 changes: 3 additions & 0 deletions barcodes_generator_product/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
32 changes: 32 additions & 0 deletions barcodes_generator_product/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (C) 2014-Today GRAP (http://www.grap.coop)
# Copyright (C) 2016-Today La Louve (http://www.lalouve.net)
# Copyright (C) 2018 Komit (https://komit-consulting.com)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
'name': 'Generate Barcodes for Products',
'summary': 'Generate Barcodes for Products (Templates and Variants)',
'version': '12.0.1.0.0',
'category': 'Tools',
'author':
'GRAP,'
'La Louve,'
'Odoo Community Association (OCA)',
'website': 'https://www.odoo-community.org',
'license': 'AGPL-3',
'depends': [
'barcodes_generator_abstract',
'product',
],
'data': [
'views/view_product_product.xml',
'views/view_product_template.xml',
],
'demo': [
'demo/res_users.xml',
'demo/barcode_rule.xml',
'demo/product.xml',
'demo/function.xml',
],
}
26 changes: 26 additions & 0 deletions barcodes_generator_product/demo/barcode_rule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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>

<!-- Note: type should be 'price' or 'weight' but this keys are define in point_of_sale module
Not a big deal, this is just demo data, used for tests.
-->
<record id="product_generated_barcode" model="barcode.rule">
<field name="name">Product Rule (Generated Barcode)</field>
<field name="barcode_nomenclature_id" ref="barcodes.default_barcode_nomenclature"/>

<field name="type">product</field>
<field name="sequence">999</field>
<field name="encoding">ean13</field>
<field name="pattern">20.....{NNNDD}</field>
<field name="generate_type" eval="'manual'" />
<field name="generate_model" eval="'product.product'" />
</record>

</odoo>
16 changes: 16 additions & 0 deletions barcodes_generator_product/demo/function.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?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>

<function model="product.template" name="generate_barcode" eval="[ref('product_template_mono_variant')]"/>

<function model="product.product" name="generate_barcode" eval="[ref('product_product_variant_1')]"/>

<function model="product.product" name="generate_barcode" eval="[ref('product_product_variant_2')]"/>

</odoo>
45 changes: 45 additions & 0 deletions barcodes_generator_product/demo/product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?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="product_template_mono_variant" model="product.template">
<field name="name">Template with Generated Barcode (Mono Variant)</field>
<field name="barcode_rule_id" ref="product_generated_barcode" />
<field name="barcode_base">50</field>
</record>

<record id="product_template_multi_variant" model="product.template">
<field name="name">Template with Generated Barcode (Multi Variant)</field>
</record>

<record id="product_product_variant_1" model="product.product">
<field name="barcode_rule_id" ref="product_generated_barcode" />
<field name="barcode_base">10001</field>
<field name="product_tmpl_id" ref="product_template_multi_variant"/>
<field name="attribute_value_ids" eval="[(6,0,[ref('product.product_attribute_value_3')])]"/>
</record>

<record id="product_product_variant_2" model="product.product">
<field name="barcode_rule_id" ref="product_generated_barcode" />
<field name="barcode_base">10002</field>
<field name="product_tmpl_id" ref="product_template_multi_variant"/>
<field name="attribute_value_ids" eval="[(6,0,[ref('product.product_attribute_value_4')])]"/>
</record>

<record id="product_template_multi_variant_attribute_line" model="product.template.attribute.line">
<field name="product_tmpl_id" ref="product_template_multi_variant"/>
<field name="attribute_id" ref="product.product_attribute_2"/>
<field name="value_ids" eval="[(6,0,[ref('product.product_attribute_value_3'), ref('product.product_attribute_value_4')])]"/>
</record>

<record id="product_template_multi_variant" model="product.template">
<field name="attribute_line_ids" eval="[(6,0,[ref('product_template_multi_variant_attribute_line')])]"/>
</record>

</odoo>
17 changes: 17 additions & 0 deletions barcodes_generator_product/demo/res_users.xml
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('product.group_product_variant')),
]" />
</record>

</odoo>
83 changes: 83 additions & 0 deletions barcodes_generator_product/i18n/barcodes_generator_product.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * barcodes_generator_product
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.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: barcodes_generator_product
#: model:ir.model.fields,help:barcodes_generator_product.field_product_template_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 ""

#. module: barcodes_generator_product
#: model:ir.model.fields,field_description:barcodes_generator_product.field_product_template_barcode_base
msgid "Barcode Base"
msgstr ""

#. module: barcodes_generator_product
#: model:ir.model.fields,field_description:barcodes_generator_product.field_product_template_barcode_rule_id
msgid "Barcode Rule"
msgstr ""

#. module: barcodes_generator_product
#: model:ir.ui.view,arch_db:barcodes_generator_product.view_product_product_form
#: model:ir.ui.view,arch_db:barcodes_generator_product.view_product_template_form
msgid "Generate Barcode (Using Barcode Rule)"
msgstr ""

#. module: barcodes_generator_product
#: model:ir.ui.view,arch_db:barcodes_generator_product.view_product_product_form
#: model:ir.ui.view,arch_db:barcodes_generator_product.view_product_template_form
msgid "Generate Base (Using Sequence)"
msgstr ""

#. module: barcodes_generator_product
#: model:ir.model.fields,field_description:barcodes_generator_product.field_product_template_generate_type
msgid "Generate Type"
msgstr ""

#. module: barcodes_generator_product
#: model:ir.model,name:barcodes_generator_product.model_product_product
msgid "Product"
msgstr ""

#. module: barcodes_generator_product
#: model:ir.model,name:barcodes_generator_product.model_product_template
msgid "Product Template"
msgstr ""

#. module: barcodes_generator_product
#: model:product.product,name:barcodes_generator_product.product_product_variant_1
#: model:product.product,name:barcodes_generator_product.product_product_variant_2
#: model:product.template,name:barcodes_generator_product.product_product_variant_1_product_template
#: model:product.template,name:barcodes_generator_product.product_product_variant_2_product_template
#: model:product.template,name:barcodes_generator_product.product_template_multi_variant
msgid "Product with Generated Barcode (Variant 2 - Black)"
msgstr ""

#. module: barcodes_generator_product
#: model:product.template,name:barcodes_generator_product.product_template_mono_variant
msgid "Template with Generated Barcode (Mono Variant)"
msgstr ""

#. module: barcodes_generator_product
#: model:product.template,name:barcodes_generator_product.product_template_multi_variant_2
msgid "Template with Generated Barcode (Multi Variant)"
msgstr ""

#. module: barcodes_generator_product
#: model:ir.model,name:barcodes_generator_product.model_barcode_rule
msgid "barcode.rule"
msgstr ""

0 comments on commit 729054b

Please sign in to comment.