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

[13.0] [MIG] barcodes_generator_abstract: Migration to v13 #317

Merged
merged 14 commits into from
Feb 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
186 changes: 186 additions & 0 deletions barcodes_generator_abstract/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
============================
Generate Barcodes (Abstract)
============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fstock--logistics--barcode-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-barcode/tree/13.0/barcodes_generator_abstract
:alt: OCA/stock-logistics-barcode
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-barcode-13-0/stock-logistics-barcode-13-0-barcodes_generator_abstract
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/150/13.0
:alt: Try me on Runbot

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

This module extends 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

**Table of contents**

.. contents::
:local:

Installation
============

This module use an extra python library named 'python-barcode' you should install
to make barcode generation works properly.

``sudo pip install python-barcode``

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

To configure this module, you need to:

* Go to Settings / Technical / Sequences & Identifiers / Barcode Nomenclatures
* Select a Nomenclature
* Create or select a rule

.. image:: https://raw.githubusercontent.com/barcodes_generator_abstract/static/description/barcode_rule_tree.png

* For manual generation, set:
* 'Base set Manually' in 'Generate Type'
* Set the model

.. image:: https://raw.githubusercontent.com/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:: https://raw.githubusercontent.com/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.

Development
===========

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 <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 <https://github.com/OCA/stock-logistics-barcode/issues/new?body=module:%20barcodes_generator_abstract%0Aversion:%2013.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
~~~~~~~

* GRAP
* La Louve
* LasLabs

Contributors
~~~~~~~~~~~~

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

* Carlos Roca

Other 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

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/stock-logistics-barcode <https://github.com/OCA/stock-logistics-barcode/tree/13.0/barcodes_generator_abstract>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions barcodes_generator_abstract/__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
23 changes: 23 additions & 0 deletions barcodes_generator_abstract/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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 (Abstract)",
"summary": "Generate Barcodes for Any Models",
"version": "13.0.1.0.0",
"category": "Tools",
"author": "GRAP, La Louve, LasLabs, Odoo Community Association (OCA)",
"website": "https://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"],
"external_dependencies": {"python": ["barcode"]},
}
17 changes: 17 additions & 0 deletions barcodes_generator_abstract/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('barcodes_generator_abstract.generate_barcode')),
]"
/>
</record>
</odoo>
Loading