Generate Barcodes for Any Models
Project description
Generate Barcodes for any Models (Abstract)
This module expends Odoo functionality, allowing user to generate barcode depending on a given barcode rule for any Model.
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:
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 library named ‘viivakoodi’ you should install to make barcode generation works properly. ‘viivakoodi’ is a more active for of ‘pyBarcode’.
sudo pip install viivakoodi
Configuration
To configure this module, you need to:
Go to Settings / Technical / Sequences & Identifiers / Barcode Nomenclatures
Select a Nomenclature
Create or select a rule
- For manual generation, set:
‘Base set Manually’ in ‘Generate Type’
Set the model
- 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
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
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
On barcode.rule model, constraint and domain system could be set between ‘type’ and ‘generate_model’ fields.
Cache is being cleared in a constraint in barcode.rule. Mutating in a constraint is bad practice & should be moved somewhere.
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 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)
Dave Lasley <dave@laslabs.com>
Maintainer
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file odoo11_addon_barcodes_generator_abstract-11.0.1.0.1.99.dev4-py2.py3-none-any.whl
.
File metadata
- Download URL: odoo11_addon_barcodes_generator_abstract-11.0.1.0.1.99.dev4-py2.py3-none-any.whl
- Upload date:
- Size: 126.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/30.4.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01faab9bb5d2f89f467bc8ff605ae35c3651962298ae514683eada47a9e906e5 |
|
MD5 | 49642dbcd59c9b0541d3b1cdd6a279bb |
|
BLAKE2b-256 | 503d2e54dcce4b21e33a3d9e76f9a0c2e5619e088c25c73554e44e5dc1f69114 |