Skip to content
Open
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
84 changes: 84 additions & 0 deletions sale_section_stock_move/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=======================
sale_section_stock_move
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1a15957a7c317b5ac5c3812ac5ec0227e3470b1cacc0023c2c642ac5178c10a9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/19.0/sale_section_stock_move
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-19-0/sale-workflow-19-0-sale_section_stock_move
: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/sale-workflow&target_branch=19.0
:alt: Try me on Runboat

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

This module propagates sale order section information to stock
operations.

It adds a Sale Section on stock moves from the related sale order line
section, and exposes the section name on stock moves and stock move
lines.

The section information is available in stock move and stock move line
list views, search filters, group by options, and in the Operations tab
of stock pickings.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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/sale-workflow/issues/new?body=module:%20sale_section_stock_move%0Aversion:%2019.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
-------

* Camptocamp

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/sale-workflow <https://github.com/OCA/sale-workflow/tree/19.0/sale_section_stock_move>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_section_stock_move/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions sale_section_stock_move/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2026 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


{
"name": "sale_section_stock_move",
"summary": "Sale section on stock moves",
"version": "19.0.1.0.0",
"category": "Sale",
"website": "https://github.com/OCA/sale-workflow",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"sale_stock",
"sale_order_line_section",
],
"data": [
"views/stock_picking_views.xml",
],
}
65 changes: 65 additions & 0 deletions sale_section_stock_move/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_section_stock_move
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 19.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-04-08 11:50+0000\n"
"PO-Revision-Date: 2026-04-08 11:50+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#. module: sale_section_stock_move
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move__display_name
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move_line__display_name
msgid "Display Name"
msgstr "Nom Affiche"

#. module: sale_section_stock_move
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move__id
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move_line__id
msgid "ID"
msgstr "ID"

#. module: sale_section_stock_move
#: model:ir.model,name:sale_section_stock_move.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Mouvements Produit (Ligne Mouvement Stock)"

#. module: sale_section_stock_move
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.stock_move_line_view_search
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.view_move_search
msgid "Sale Order"
msgstr "Commande Client"

#. module: sale_section_stock_move
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move__sale_section_id
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move_line__sale_section_id
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.stock_move_line_view_search
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.view_move_search
msgid "Sale Section"
msgstr "Section Vente"

#. module: sale_section_stock_move
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.stock_move_line_view_search
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.view_move_search
msgid "Section"
msgstr "Section"

#. module: sale_section_stock_move
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move__sale_section_name
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move_line__sale_section_name
msgid "Section Name"
msgstr "Nom Section"

#. module: sale_section_stock_move
#: model:ir.model,name:sale_section_stock_move.model_stock_move
msgid "Stock Move"
msgstr "Mouvement Stock"
64 changes: 64 additions & 0 deletions sale_section_stock_move/i18n/sale_section_stock_move.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_section_stock_move
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 19.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-04-08 11:50+0000\n"
"PO-Revision-Date: 2026-04-08 11:50+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_section_stock_move
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move__display_name
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move_line__display_name
msgid "Display Name"
msgstr ""

#. module: sale_section_stock_move
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move__id
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move_line__id
msgid "ID"
msgstr ""

#. module: sale_section_stock_move
#: model:ir.model,name:sale_section_stock_move.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: sale_section_stock_move
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.stock_move_line_view_search
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.view_move_search
msgid "Sale Order"
msgstr ""

#. module: sale_section_stock_move
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move__sale_section_id
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move_line__sale_section_id
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.stock_move_line_view_search
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.view_move_search
msgid "Sale Section"
msgstr ""

#. module: sale_section_stock_move
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.stock_move_line_view_search
#: model_terms:ir.ui.view,arch_db:sale_section_stock_move.view_move_search
msgid "Section"
msgstr ""

#. module: sale_section_stock_move
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move__sale_section_name
#: model:ir.model.fields,field_description:sale_section_stock_move.field_stock_move_line__sale_section_name
msgid "Section Name"
msgstr ""

#. module: sale_section_stock_move
#: model:ir.model,name:sale_section_stock_move.model_stock_move
msgid "Stock Move"
msgstr ""
2 changes: 2 additions & 0 deletions sale_section_stock_move/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_move
from . import stock_move_line
23 changes: 23 additions & 0 deletions sale_section_stock_move/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2026 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class StockMove(models.Model):
_inherit = "stock.move"

sale_section_id = fields.Many2one(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this relevant for ALL moves and move lines? 🤔
A change on so line section might have a big perf impact. no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this relevant for ALL moves and move lines?

The fields are added on stock.move and stock.move.line, so the columns exist for all records, but they’ll only be filled (non-null) for moves/move lines that come from a sale order line (sale_line_id) and where that sale line has a section (section_id). For other moves (inventory, manufacturing, purchase, etc.) it stays empty.

A change on so line section might have a big perf impact. no?

It can, yes.
Because sale_section_id / sale_section_name are stored related fields, if you change the section on a sale order line, Odoo may need to recompute + write the stored value on all dependent records:

  • all stock.move linked to that sale line (sale_line_id)
  • and then all stock.move.line linked to those moves
    So if someone bulk-updates sections on confirmed orders with lots of moves/move lines, that can trigger a large cascade of writes (and be noticeable on big DBs).
    If section changes are rare, the impact is usually limited.

Another option:
Make sale_section_* non-stored computed/related fields.

  • Pros: changing the section won’t trigger mass writes on moves/move lines.
  • Cons: you generally lose efficient search/group-by on those fields (or it becomes slower because it computes on the fly).

comodel_name="sale.order.line",
string="Sale Section",
related="sale_line_id.section_id",
store=True,
readonly=True,
index="btree_not_null",
)
sale_section_name = fields.Text(
string="Section Name",
related="sale_section_id.name",
store=True,
readonly=True,
)
23 changes: 23 additions & 0 deletions sale_section_stock_move/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2026 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

sale_section_id = fields.Many2one(
comodel_name="sale.order.line",
string="Sale Section",
related="move_id.sale_section_id",
store=True,
readonly=True,
index="btree_not_null",
)
sale_section_name = fields.Text(
string="Section Name",
related="sale_section_id.name",
store=True,
readonly=True,
)
3 changes: 3 additions & 0 deletions sale_section_stock_move/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions sale_section_stock_move/readme/CONTRIBUTOR.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Telmo Santos <telmo.santos@camptocamp.com>
7 changes: 7 additions & 0 deletions sale_section_stock_move/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module propagates sale order section information to stock operations.

It adds a Sale Section on stock moves from the related sale order line section,
and exposes the section name on stock moves and stock move lines.

The section information is available in stock move and stock move line list views,
search filters, group by options, and in the Operations tab of stock pickings.
Loading
Loading