Sylvain LE GAL
8 years ago
17 changed files with 324 additions and 118 deletions
-
115barcodes_generate/README.rst
-
49barcodes_generate/__openerp__.py
-
25barcodes_generate/demo/barcode.rule.xml
-
26barcodes_generate/demo/barcode_rule.xml
-
12barcodes_generate/demo/res_users.xml
-
118barcodes_generate/models/barcode_generate_mixin.py
-
28barcodes_generate/models/barcode_rule.py
-
5barcodes_generate/models/product_product.py
-
4barcodes_generate/models/res_partner.py
-
5barcodes_generate/security/res_groups.xml
-
BINbarcodes_generate/static/description/barcode_rule_form.png
-
0barcodes_generate/static/description/barcode_rule_tree.png
-
BINbarcodes_generate/static/description/product_product_form_empty.png
-
BINbarcodes_generate/static/description/product_product_form_generated.png
-
5barcodes_generate/views/view_barcode_rule.xml
-
25barcodes_generate/views/view_product_product.xml
-
25barcodes_generate/views/view_res_partner.xml
@ -0,0 +1,115 @@ |
|||
.. 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 |
|||
|
|||
============== |
|||
{module_title} |
|||
============== |
|||
|
|||
============================================ |
|||
Generate Barcodes for Products and Customers |
|||
============================================ |
|||
|
|||
This module expends Odoo functionnality, allowing user to generate barcode |
|||
depending on a given barcode rule. |
|||
|
|||
For exemple, a typical pattern for products is "23.....{NNNDD}" that means |
|||
that: |
|||
* the EAN13 code will begin by '23' ; |
|||
* 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 product.product or a res.partner |
|||
|
|||
* Generate the next Barcode base of a pattern. (to avoid duplicate barcode) |
|||
* Generate a barcode, based on a pattern and a barcode base |
|||
|
|||
Configuration |
|||
============= |
|||
|
|||
To configure this module, you need to: |
|||
|
|||
* Go to Point Of Sale / Configuration / Barcode Nomenclatures and select |
|||
* Select a Nomenclature |
|||
* Create or select a rule |
|||
.. figure:: barcodes_generate/static/description/barcode_rule_tree.png |
|||
|
|||
* Check 'Available for Products', or 'Available for Partners' Checkbox. |
|||
|
|||
.. figure:: barcodes_generate/static/description/barcode_rule_form.png |
|||
|
|||
Usage |
|||
===== |
|||
|
|||
To use this module, you need to: |
|||
|
|||
* Go to a Product form (or a Partner Form): |
|||
* set a rule to the current object |
|||
|
|||
.. figure:: barcodes_generate/static/description/product_product_form_empty.png |
|||
|
|||
* Click on 'Generate Base and Barcode' |
|||
|
|||
.. figure:: barcodes_generate/static/description/product_product_form_generated.png |
|||
|
|||
Alternatively you can set manually a barcode base, and click only on Generate barcode. |
|||
|
|||
.. 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 |
|||
|
|||
Known issues / Roadmap |
|||
====================== |
|||
|
|||
Dependency to point_of_sale is required because barcode field, defined in 'base' |
|||
module (in the res.partner model), is defined in a 'point_of_sale' view. |
|||
Furthermore, barcode nomenclature menu is available on Point Of Sale submenu. |
|||
|
|||
It's a relative problem, because product barcodes generation will occures |
|||
mostly in a Point of Sale context. |
|||
|
|||
You could comment 'point_of_sale' dependencies if you want to use this module |
|||
without point of sale installed. |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues |
|||
<https://github.com/OCA/pos/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 |
|||
------ |
|||
|
|||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
|||
|
|||
* 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. |
|||
|
@ -0,0 +1,25 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!-- |
|||
Copyright (C) 2016-Today: GRAP (http://www.grap.coop) |
|||
Copyright (C) 2016-Today GRAP (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="point_of_sale.barcode_rule_price_two_dec" model="barcode.rule"> |
|||
<field name="is_product_available" eval="True" /> |
|||
</record> |
|||
|
|||
<record id="partner_generated_barcode" model="barcode.rule"> |
|||
<field name="name">Partner (Generated Barcode)</field> |
|||
<field name="is_partner_available" eval="True" /> |
|||
<field name="type">client</field> |
|||
<field name="encoding">ean13</field> |
|||
<field name="encoding">042.........</field> |
|||
<field name="sequence">999</field> |
|||
</record> |
|||
|
|||
|
|||
</odoo> |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!-- |
|||
Copyright (C) 2016-Today: GRAP (http://www.grap.coop) |
|||
Copyright (C) 2016-Today GRAP (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="point_of_sale.barcode_rule_price_two_dec" model="barcode.rule"> |
|||
<field name="is_product_available" eval="True" /> |
|||
</record> |
|||
|
|||
<record id="partner_generated_barcode" model="barcode.rule"> |
|||
<field name="name">Partner (Generated Barcode)</field> |
|||
<field name="barcode_nomenclature_id" ref="barcodes.default_barcode_nomenclature"/> |
|||
<field name="is_partner_available" eval="True" /> |
|||
<field name="type">client</field> |
|||
<field name="encoding">ean13</field> |
|||
<field name="pattern">042.........</field> |
|||
<field name="sequence">999</field> |
|||
</record> |
|||
|
|||
|
|||
</odoo> |
@ -1,13 +1,19 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!-- |
|||
Copyright (C) 2016-Today: GRAP (http://www.grap.coop) |
|||
Copyright (C) 2016-Today GRAP (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). |
|||
--> |
|||
|
|||
<openerp><data> |
|||
<odoo> |
|||
|
|||
<record id="base.user_root" model="res.users"> |
|||
<field name="groups_id" eval="[(4, ref('barcodes_generate.generate_product_barcode')), (4, ref('barcodes_generate.generate_partner_barcode'))]" /> |
|||
<field name="groups_id" eval="[ |
|||
(4, ref('barcodes_generate.generate_product_barcode')), |
|||
(4, ref('barcodes_generate.generate_partner_barcode')), |
|||
(4, ref('product.group_product_variant')), |
|||
]" /> |
|||
</record> |
|||
</data></openerp> |
|||
|
|||
</odoo> |
@ -1,27 +1,21 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright (C) 2014 GRAP (http://www.grap.coop) |
|||
# Copyright (C) 2016-Today GRAP (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). |
|||
|
|||
from openerp.osv import fields |
|||
from openerp.osv.orm import Model |
|||
from openerp import models, fields |
|||
|
|||
|
|||
class barcode_rule(Model): |
|||
class barcode_rule(models.Model): |
|||
_inherit = 'barcode.rule' |
|||
|
|||
_columns = { |
|||
'is_product_available': fields.boolean( |
|||
string='Available for Products', help="If checked, users with" |
|||
" specific access right will have the possibility to generate" |
|||
" barcodes with this pattern for the products."), |
|||
'is_partner_available': fields.boolean( |
|||
string='Available for Partners', help="If checked, users with" |
|||
" specific access right will have the possibility to generate" |
|||
" barcodes with this pattern for the partners."), |
|||
} |
|||
is_product_available = fields.Boolean( |
|||
string='Available for Products', help="If checked, users with" |
|||
" specific access right will have the possibility to generate" |
|||
" barcodes with this pattern for the products.") |
|||
|
|||
# TODO set constraint |
|||
# is_product_available and is_partner_available: |
|||
# - should be possible only for ean13 barcode rule |
|||
# - should be possible only if pattern contains at leas one '.' char |
|||
is_partner_available = fields.Boolean( |
|||
string='Available for Partners', help="If checked, users with" |
|||
" specific access right will have the possibility to generate" |
|||
" barcodes with this pattern for the partners.") |
@ -1,11 +1,12 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright (C) 2014 GRAP (http://www.grap.coop) |
|||
# Copyright (C) 2016-Today GRAP (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). |
|||
|
|||
from openerp.osv.orm import Model |
|||
from openerp import models |
|||
|
|||
|
|||
class product_product(Model): |
|||
class ProductProduct(models.Model): |
|||
_name = 'product.product' |
|||
_inherit = ['product.product', 'barcode.generate.mixin'] |
After Width: 675 | Height: 131 | Size: 16 KiB |
Before Width: 760 | Height: 61 | Size: 8.8 KiB After Width: 760 | Height: 61 | Size: 8.8 KiB |
After Width: 424 | Height: 126 | Size: 11 KiB |
After Width: 334 | Height: 80 | Size: 8.3 KiB |
@ -1,28 +1,39 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!-- |
|||
Copyright (C) 2016-Today: GRAP (http://www.grap.coop) |
|||
Copyright (C) 2016-Today GRAP (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). |
|||
--> |
|||
|
|||
<openerp><data> |
|||
<odoo> |
|||
|
|||
<record id="view_product_product_form" model="ir.ui.view"> |
|||
<field name="model">product.product</field> |
|||
<field name="inherit_id" ref="product.product_normal_form_view"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="default_code" position="after"> |
|||
<field name="barcode" position="before"> |
|||
<field name="barcode_rule_id" |
|||
domain="[('is_product_available', '=', True)]" |
|||
groups="barcodes_generate.generate_product_barcode" colspan="2" |
|||
attrs="{'readonly': [('ean13', '!=', False)]}"/> |
|||
<field name="barcode_base" attrs="{'invisible': [('barcode_rule_id', '=', False)], 'readonly': [('ean13', '!=', False)]}" |
|||
attrs="{'readonly': [('barcode', '!=', False)]}"/> |
|||
<field name="barcode_base" attrs="{'invisible': [('barcode_rule_id', '=', False)], 'readonly': [('barcode', '!=', False)]}" |
|||
groups="barcodes_generate.generate_product_barcode" colspan="2"/> |
|||
</field> |
|||
<field name="barcode" position="after"> |
|||
<button name="generate_base_barcode" type="object" string="Generate Base and Barcode" |
|||
attrs="{'invisible': ['|', '|', |
|||
('barcode_rule_id', '=', False), |
|||
('barcode', '!=', False), |
|||
('barcode_base', '!=', False)]}" |
|||
groups="barcodes_generate.generate_product_barcode" colspan="1"/> |
|||
<button name="generate_barcode" type="object" string="Generate Barcode" |
|||
attrs="{'invisible': ['|','|', ('ean13', '!=', False), ('barcode_rule_id', '=', False), ('barcode_base', '=', 0)]}" |
|||
groups="barcodes_generate.generate_product_barcode" colspan="2"/> |
|||
attrs="{'invisible': ['|', |
|||
('barcode_rule_id', '=', False), |
|||
('barcode', '!=', False)]}" |
|||
groups="barcodes_generate.generate_partner_barcode" colspan="1"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
</data></openerp> |
|||
</odoo> |
@ -1,28 +1,39 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!-- |
|||
Copyright (C) 2016-Today: GRAP (http://www.grap.coop) |
|||
Copyright (C) 2016-Today GRAP (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). |
|||
--> |
|||
|
|||
<openerp><data> |
|||
<odoo> |
|||
|
|||
<record id="view_res_partner_form" model="ir.ui.view"> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="point_of_sale.view_partner_property_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="ean13" position="before"> |
|||
<field name="barcode" position="before"> |
|||
<field name="barcode_rule_id" |
|||
domain="[('is_partner_available', '=', True)]" |
|||
groups="barcodes_generate.generate_partner_barcode" colspan="2" |
|||
attrs="{'readonly': [('ean13', '!=', False)]}"/> |
|||
<field name="barcode_base" attrs="{'invisible': [('barcode_rule_id', '=', False)], 'readonly': [('ean13', '!=', False)]}" |
|||
attrs="{'readonly': [('barcode', '!=', False)]}"/> |
|||
<field name="barcode_base" attrs="{'invisible': [('barcode_rule_id', '=', False)], 'readonly': [('barcode', '!=', False)]}" |
|||
groups="barcodes_generate.generate_partner_barcode" colspan="2"/> |
|||
</field> |
|||
<field name="barcode" position="after"> |
|||
<button name="generate_base_barcode" type="object" string="Generate Base and Barcode" |
|||
attrs="{'invisible': ['|', '|', |
|||
('barcode_rule_id', '=', False), |
|||
('barcode', '!=', False), |
|||
('barcode_base', '!=', False)]}" |
|||
groups="barcodes_generate.generate_partner_barcode" colspan="1"/> |
|||
<button name="generate_barcode" type="object" string="Generate Barcode" |
|||
attrs="{'invisible': ['|','|', ('ean13', '!=', False), ('barcode_rule_id', '=', False), ('barcode_base', '=', 0)]}" |
|||
groups="barcodes_generate.generate_partner_barcode" colspan="2"/> |
|||
attrs="{'invisible': ['|', |
|||
('barcode_rule_id', '=', False), |
|||
('barcode', '!=', False)]}" |
|||
groups="barcodes_generate.generate_partner_barcode" colspan="1"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
</data></openerp> |
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue