Skip to content

Commit

Permalink
[IMP] barcodes_generator_abstract: pre-commit auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
niboo-jva committed Mar 20, 2024
1 parent bf9bf0b commit fbfab43
Show file tree
Hide file tree
Showing 19 changed files with 220 additions and 209 deletions.
142 changes: 77 additions & 65 deletions barcodes_generator_abstract/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,41 @@ Generate Barcodes (Abstract)
: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/16.0/barcodes_generator_abstract
:target: https://github.com/OCA/stock-logistics-barcode/tree/17.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-16-0/stock-logistics-barcode-16-0-barcodes_generator_abstract
:target: https://translation.odoo-community.org/projects/stock-logistics-barcode-17-0/stock-logistics-barcode-17-0-barcodes_generator_abstract
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-barcode&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-barcode&target_branch=17.0
:alt: Try me on Runboat

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

This module extends Odoo functionality, allowing user to generate barcode
depending on a given barcode rule for any Model.
This module extends Odoo functionality, allowing user to generate
barcode depending on a given barcode rule for any Model.

For example, if the barcode pattern is "20.....{NNNDD}":

* the EAN13 code will begin with '20',
* followed by 5 digits (named *Barcode Base* in this module),
* followed by 5 others digits to define the variable price with 2 decimals,
* the last digit (the 13rd digit) is the control digit (i.e. the checksum).
- the EAN13 code will begin with '20',
- followed by 5 digits (named *Barcode Base* in this module),
- followed by 5 others digits to define the variable price with 2
decimals,
- the last digit (the 13rd digit) is the control digit (i.e. the
checksum).

With this module, it is possible to:

* Affect a pattern (barcode.rule) to a model
- 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).
* automatically by a sequence, if you want to let Odoo increment a
- 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).
- automatically by a sequence, if you want to let Odoo increment a
sequence (typical case of a customer number incrementation).

* Generate a barcode, based on the defined pattern and the barcode base
- Generate a barcode, based on the defined pattern and the barcode base

**Table of contents**

Expand All @@ -58,8 +61,8 @@ With this module, it is possible to:
Installation
============

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

``sudo pip install python-barcode``

Expand All @@ -68,114 +71,123 @@ Configuration

To configure this module, you need to:

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

|image|

.. image:: https://raw.githubusercontent.com/OCA/stock-logistics-barcode/16.0/barcodes_generator_abstract/static/description/barcode_nomenclature_form.png
- For manual generation, set:

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

.. image:: https://raw.githubusercontent.com/OCA/stock-logistics-barcode/16.0/barcodes_generator_abstract/static/description/barcode_rule_form_manual.png
|image1|

* 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
- For automatic generation, set:

.. image:: https://raw.githubusercontent.com/OCA/stock-logistics-barcode/16.0/barcodes_generator_abstract/static/description/barcode_rule_form_sequence.png
- 'Base managed by Sequence' in 'Generate Type'
- Set the model
- Generate a new sequence by button, or affect a existing one

|image2|

In all cases, padding will be computed automaticaly, based on the number
of '.' in the Barcode Pattern field.

.. |image| image:: https://raw.githubusercontent.com/OCA/stock-logistics-barcode/17.0/barcodes_generator_abstract/static/description/barcode_nomenclature_form.png
.. |image1| image:: https://raw.githubusercontent.com/OCA/stock-logistics-barcode/17.0/barcodes_generator_abstract/static/description/barcode_rule_form_manual.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/stock-logistics-barcode/17.0/barcodes_generator_abstract/static/description/barcode_rule_form_sequence.png

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.
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.

If you want to generate barcode for another model, you can create a custom
module that depend on 'barcodes_generator_abstract' and inherit your model
like that:
If you want to generate barcode for another model, you can create a
custom module that depend on 'barcodes_generator_abstract' and inherit
your model like that:

.. code::
::

class MyModel(models.Model):
_name = 'my.model'
_inherit = ['my.model', 'barcode.generate.mixin']
class MyModel(models.Model):
_name = 'my.model'
_inherit = ['my.model', 'barcode.generate.mixin']

class barcode_rule(models.Model):
_inherit = 'barcode.rule'
class barcode_rule(models.Model):
_inherit = 'barcode.rule'

generate_model = fields.Selection(selection_add=[('my.model', 'My Model')])
generate_model = fields.Selection(selection_add=[('my.model', 'My Model')])

Eventually, you should inherit your model view adding buttons and fields.
Eventually, 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.
- 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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-barcode/issues/new?body=module:%20barcodes_generator_abstract%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-barcode/issues/new?body=module:%20barcodes_generator_abstract%0Aversion:%2017.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>`__:
- Sylvain LE GAL (https://twitter.com/legalsylvain)
- Dave Lasley <dave@laslabs.com>
- `Tecnativa <https://www.tecnativa.com>`__:

* Carlos Roca
- Carlos Roca

* `Ooops404 <https://www.ooops404.com>`__:
- `Ooops404 <https://www.ooops404.com>`__:

* Ilyas <irazor147@gmail.com>
- Ilyas <irazor147@gmail.com>

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
- 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.

Expand All @@ -195,6 +207,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-legalsylvain|

This module is part of the `OCA/stock-logistics-barcode <https://github.com/OCA/stock-logistics-barcode/tree/16.0/barcodes_generator_abstract>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-barcode <https://github.com/OCA/stock-logistics-barcode/tree/17.0/barcodes_generator_abstract>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 0 additions & 1 deletion barcodes_generator_abstract/models/barcode_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class BarcodeRule(models.Model):

_inherit = "barcode.rule"

# Column Section
Expand Down
3 changes: 3 additions & 0 deletions barcodes_generator_abstract/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
24 changes: 24 additions & 0 deletions barcodes_generator_abstract/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
To configure this module, you need to:

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

![image](../static/description/barcode_nomenclature_form.png)

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

![image](../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](../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.
23 changes: 0 additions & 23 deletions barcodes_generator_abstract/readme/CONFIGURE.rst

This file was deleted.

6 changes: 6 additions & 0 deletions barcodes_generator_abstract/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Sylvain LE GAL (<https://twitter.com/legalsylvain>)
- Dave Lasley \<<dave@laslabs.com>\>
- [Tecnativa](https://www.tecnativa.com):
- Carlos Roca
- [Ooops404](https://www.ooops404.com):
- Ilyas \<<irazor147@gmail.com>\>
9 changes: 0 additions & 9 deletions barcodes_generator_abstract/readme/CONTRIBUTORS.rst

This file was deleted.

5 changes: 5 additions & 0 deletions barcodes_generator_abstract/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 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>
5 changes: 0 additions & 5 deletions barcodes_generator_abstract/readme/CREDITS.rst

This file was deleted.

23 changes: 23 additions & 0 deletions barcodes_generator_abstract/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
This module extends Odoo functionality, allowing user to generate
barcode depending on a given barcode rule for any Model.

For example, if the barcode pattern is "20.....{NNNDD}":

- the EAN13 code will begin with '20',
- followed by 5 digits (named *Barcode Base* in this module),
- followed by 5 others digits to define the variable price with 2
decimals,
- the last digit (the 13rd digit) is the control digit (i.e. the
checksum).

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).
- automatically by a sequence, if you want to let Odoo increment a
sequence (typical case of a customer number incrementation).

- Generate a barcode, based on the defined pattern and the barcode base
21 changes: 0 additions & 21 deletions barcodes_generator_abstract/readme/DESCRIPTION.rst

This file was deleted.

4 changes: 4 additions & 0 deletions barcodes_generator_abstract/readme/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module use an extra python library named 'python-barcode' you
should install to make barcode generation works properly.

`sudo pip install python-barcode`
4 changes: 0 additions & 4 deletions barcodes_generator_abstract/readme/INSTALL.rst

This file was deleted.

4 changes: 4 additions & 0 deletions barcodes_generator_abstract/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- 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.
Loading

0 comments on commit fbfab43

Please sign in to comment.