Skip to main content
Odoo Community Association

Base Line Numbering

Beta License: AGPL-3 OCA/server-ux Translate me on Weblate Try me on Runboat

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 integer field of the lines that stores the position.

  • _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

Authors

  • Camptocamp

Contributors

Maintainers

This module is maintained by the OCA.

Odoo Community Association

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

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo-addon-base-line-numbering 19.0.1.0.0.2
File Interpreter ABI Platform Actions
odoo_addon_base_line_numbering-19.0.1.0.0.2-py3-none-any.whl Python 3 none any Details for odoo_addon_base_line_numbering-19.0.1.0.0.2-py3-none-any.whl

Release files / odoo_addon_base_line_numbering-19.0.1.0.0.2-py3-none-any.whl

Download URL odoo_addon_base_line_numbering-19.0.1.0.0.2-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ca766a5584b88b46d7a4927a3eddc068856e21ab365ff4227aa0b8d03ebd64f
BLAKE2b-256 checksum
How to use checksums
1264cd7e6bac6a258e269522d9d1d776573f84685aec7c5d0537f91672321c58
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.0.0.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page