Base Line Numbering
Technical module providing line.numbering.mixin, a mixin that numbers the lines of a record (e.g. the lines of an order) with consecutive positions (1, 2, 3, … or, with a step of 10, 10, 20, 30, …), following the lines’ order.
It has no functional effect on its own. It is a building block for modules that need a stable line reference, shown to users and exchanged with third parties (e.g. a position on purchase, sale or stock move lines).
Positions are renumbered automatically when lines are added or removed, in any state of the record. Consuming modules can opt out for specific records (e.g. records already sent to a partner).
Table of contents
Use Cases / Context
Several documents exchanged with partners (orders, deliveries, invoices) refer to their lines by a position number, like 10, 20, 30. Each module that needs it used to implement its own numbering. This module provides the numbering once, so that every model numbers its lines the same way.
Usage
This module is meant for developers. Inherit the mixin on the parent model and declare which lines to number and where to store their position:
class PurchaseOrder(models.Model):
_name = "purchase.order"
_inherit = ["purchase.order", "line.numbering.mixin"]
_line_numbering_lines_field = "order_line"
_line_numbering_position_field = "position"
_line_numbering_step = 10
_line_numbering_lines_field: the one2many field holding the lines to number.
_line_numbering_position_field: the field of the lines that stores the position. It is meant to be an integer field; a char field gets the positions as strings (e.g. when it also stores references coming from a partner).
_line_numbering_step: the gap between two consecutive positions (default: 1).
renumber_lines_positions() numbers the lines of the records explicitly. create() and write() call it automatically when the lines change.
The behaviour can be adapted by overriding:
_line_renumber_needed(): return False to skip the automatic renumbering for a record (e.g. a locked one). By default, it is skipped only when the skip_line_auto_renumber context key is set.
_line_renumber_trigger_fields(): the write() keys that re-trigger the numbering. Defaults to [_line_numbering_lines_field]. Override it when _line_numbering_lines_field is a computed one2many, which never appears in write() values.
_line_renumber_get_lines(): the lines to number, in the order they get their positions. Defaults to the lines of _line_numbering_lines_field in their model’s order.
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 to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Contributors
-
Akim Juillerat <akim.juillerat@camptocamp.com>
Ricardo Almeida Soares <ricardo.almeidasoares@camptocamp.com>
Iván Todorovich <ivan.todorovich@camptocamp.com>
Simone Orsi <simone.orsi@camptocamp.com>
Maintainers
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.
This module is part of the OCA/server-ux project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Metadata
Release files for odoo-addon-base-line-numbering 19.0.1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| odoo_addon_base_line_numbering-19.0.1.1.0-py3-none-any.whl | Python 3 | none | any | Details for odoo_addon_base_line_numbering-19.0.1.1.0-py3-none-any.whl |
Release files / odoo_addon_base_line_numbering-19.0.1.1.0-py3-none-any.whl
| Download URL | odoo_addon_base_line_numbering-19.0.1.1.0-py3-none-any.whl |
|---|---|
| Size | 29.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43d648c96de365f85718d12579d62a95e8e8b1a3ef16da0bcfec5513da9df2c5
|
|
BLAKE2b-256 checksum How to use checksums |
a27c3c9628bb2c71b79d74c81cabcba63943a7910d20609525cca7e9f2662bc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for odoo-addon-base-line-numbering 19.0.1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.