Skip to content

Commit 1a8f4cc

Browse files
committed
Merge PR #3590 into 18.0
Signed-off-by rousseldenis
2 parents 3a55bc7 + 673a994 commit 1a8f4cc

19 files changed

Lines changed: 1088 additions & 0 deletions
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
============================
2+
Sale Order Line Chained Move
3+
============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:ded0dba3ccaa0f44a289ce69ff36abe95752835336cbb561c16596c2f337598e
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Production/Stable
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_order_line_chained_move
21+
:alt: OCA/sale-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_line_chained_move
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module defines a technical field to store the related sale order
32+
line on stock move level in order to get all chained moves on sale order
33+
line side.
34+
35+
In case the stock move contains multiple lines of the same product,
36+
Odoo's default behaviour is to merge those lines into the same one.
37+
38+
With this module, there is the option of preserving one move for each
39+
sale order line, which enables correct tracing of each move back to its
40+
source.
41+
42+
Each stock rule can define how the moves it creates should behave. If at
43+
least one move in the chain of moves is set to preserve one move per
44+
sale order line, all moves in the chain will act accordingly.
45+
46+
**Table of contents**
47+
48+
.. contents::
49+
:local:
50+
51+
Usage
52+
=====
53+
54+
Navigate to Inventory > Configuration > Rules.
55+
56+
For each rule, select "Preserve Separate Sale Order Lines" if you would
57+
like to have one move for each order line. Uncheck the option if you're
58+
ok with Odoo merging lines with the same product.
59+
60+
Bug Tracker
61+
===========
62+
63+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
64+
In case of trouble, please check there if your issue has already been reported.
65+
If you spotted it first, help us to smash it by providing a detailed and welcomed
66+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_line_chained_move%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
67+
68+
Do not contact contributors directly about support or help with technical issues.
69+
70+
Credits
71+
=======
72+
73+
Authors
74+
-------
75+
76+
* ACSONE SA/NV
77+
78+
Contributors
79+
------------
80+
81+
- Denis Roussel <denis.roussel@acsone.eu>
82+
83+
- Ooops404
84+
85+
- PyTech SRL
86+
87+
- Alessandro Uffreduzzi <alessandro.uffreduzzi@pytech.it>
88+
89+
- Marie Lejeune <marie.lejeune@acsone.eu>
90+
91+
Maintainers
92+
-----------
93+
94+
This module is maintained by the OCA.
95+
96+
.. image:: https://odoo-community.org/logo.png
97+
:alt: Odoo Community Association
98+
:target: https://odoo-community.org
99+
100+
OCA, or the Odoo Community Association, is a nonprofit organization whose
101+
mission is to support the collaborative development of Odoo features and
102+
promote its widespread use.
103+
104+
.. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px
105+
:target: https://github.com/rousseldenis
106+
:alt: rousseldenis
107+
108+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
109+
110+
|maintainer-rousseldenis|
111+
112+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_order_line_chained_move>`_ project on GitHub.
113+
114+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from .hooks import post_init_hook
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2020 ACSONE SA/NV
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Sale Order Line Chained Move",
6+
"summary": """
7+
This module adds a field on sale order line to get all related move lines""",
8+
"version": "18.0.1.0.0",
9+
"license": "AGPL-3",
10+
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
11+
"maintainers": ["rousseldenis"],
12+
"website": "https://github.com/OCA/sale-workflow",
13+
"development_status": "Production/Stable",
14+
"depends": ["sale_stock"],
15+
"data": ["views/stock_rule_views.xml"],
16+
"post_init_hook": "post_init_hook",
17+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2021 ACSONE SA/NV
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
5+
def __find_origin_moves(moves, visited=None):
6+
all_moves = moves
7+
unvisited_moves = (moves - visited) if visited else moves
8+
for move in unvisited_moves:
9+
visited = visited + move if visited else move
10+
if move.move_orig_ids:
11+
all_moves |= __find_origin_moves(move.move_orig_ids, visited)
12+
return all_moves
13+
14+
15+
def __fill_related(moves, line_id):
16+
for move in moves:
17+
moves_to_write = move
18+
if move.move_orig_ids:
19+
moves_to_write |= __find_origin_moves(move.move_orig_ids)
20+
moves_to_write.write({"related_sale_line_id": line_id.id})
21+
22+
23+
def _fill_in_related_sale_line(env):
24+
"""Update related_sale_line_id on recursive moves"""
25+
moves = env["stock.move"].search([("sale_line_id", "!=", False)])
26+
for move in moves:
27+
__fill_related(move.move_orig_ids, move.sale_line_id)
28+
29+
30+
def post_init_hook(env):
31+
_fill_in_related_sale_line(env)
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_order_line_chained_move
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 14.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2023-11-02 17:38+0000\n"
10+
"Last-Translator: Francesco Foresti <francesco.foresti@ooops404.com>\n"
11+
"Language-Team: none\n"
12+
"Language: it\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 4.17\n"
18+
19+
#. module: sale_order_line_chained_move
20+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_sale_order_line__chained_move_ids
21+
msgid "Chained Move"
22+
msgstr "Movimento collegato"
23+
24+
#. module: sale_order_line_chained_move
25+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_sale_order_line__display_name
26+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_move__display_name
27+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_rule__display_name
28+
msgid "Display Name"
29+
msgstr "Nome visualizzato"
30+
31+
#. module: sale_order_line_chained_move
32+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_sale_order_line__id
33+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_move__id
34+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_rule__id
35+
msgid "ID"
36+
msgstr "ID"
37+
38+
#. module: sale_order_line_chained_move
39+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_sale_order_line____last_update
40+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_move____last_update
41+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_rule____last_update
42+
msgid "Last Modified on"
43+
msgstr "Ultima modifica il"
44+
45+
#. module: sale_order_line_chained_move
46+
#: model:stock.rule,name:sale_order_line_chained_move.sale_chained_out_customers_rule
47+
msgid "Out -> Customers"
48+
msgstr "In uscita -> Clienti"
49+
50+
#. module: sale_order_line_chained_move
51+
#: model:stock.rule,name:sale_order_line_chained_move.sale_chained_quality_out_rule
52+
msgid "Pack -> Out"
53+
msgstr "Pack -> In uscita"
54+
55+
#. module: sale_order_line_chained_move
56+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_rule__preserve_separate_so_lines
57+
msgid "Preserve Separate Sale Order Lines"
58+
msgstr "Preserva righe ordine di vendita separate"
59+
60+
#. module: sale_order_line_chained_move
61+
#: model:ir.model.fields,help:sale_order_line_chained_move.field_stock_rule__preserve_separate_so_lines
62+
msgid ""
63+
"Prevents Odoo's default behaviour of merging moves with the same product."
64+
msgstr ""
65+
"Previene il comportamento base di odoo di unire i movimenti di magazzino "
66+
"dello stesso prodotto."
67+
68+
#. module: sale_order_line_chained_move
69+
#: model:product.product,name:sale_order_line_chained_move.product_product_two_steps
70+
#: model:product.template,name:sale_order_line_chained_move.product_product_two_steps_product_template
71+
msgid "Product Test Sale Chained Move"
72+
msgstr "Prodotto test vendita movimento collegato"
73+
74+
#. module: sale_order_line_chained_move
75+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_move__related_sale_line_id
76+
msgid "Related Sale Line"
77+
msgstr "Riga ordine di vendita collegata"
78+
79+
#. module: sale_order_line_chained_move
80+
#: model:stock.location.route,name:sale_order_line_chained_move.route_product_sale_chained
81+
msgid "Route for Chained Sale Moves with Pack"
82+
msgstr "Rotta per movimenti collegati vendita con pack"
83+
84+
#. module: sale_order_line_chained_move
85+
#: model:ir.model,name:sale_order_line_chained_move.model_sale_order_line
86+
msgid "Sales Order Line"
87+
msgstr "Riga ordine di vendita"
88+
89+
#. module: sale_order_line_chained_move
90+
#: model:stock.rule,name:sale_order_line_chained_move.sale_chained_stock_out_rule
91+
msgid "Stock -> Pack"
92+
msgstr "Giacenza -> Pack"
93+
94+
#. module: sale_order_line_chained_move
95+
#: model:ir.model,name:sale_order_line_chained_move.model_stock_move
96+
msgid "Stock Move"
97+
msgstr "Movimento di magazzino"
98+
99+
#. module: sale_order_line_chained_move
100+
#: model:ir.model,name:sale_order_line_chained_move.model_stock_rule
101+
msgid "Stock Rule"
102+
msgstr "Regola di giacenza"
103+
104+
#. module: sale_order_line_chained_move
105+
#: model:product.product,uom_name:sale_order_line_chained_move.product_product_two_steps
106+
#: model:product.template,uom_name:sale_order_line_chained_move.product_product_two_steps_product_template
107+
msgid "Units"
108+
msgstr "Unità"
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_order_line_chained_move
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: sale_order_line_chained_move
17+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_sale_order_line__chained_move_ids
18+
msgid "Chained Move"
19+
msgstr ""
20+
21+
#. module: sale_order_line_chained_move
22+
#: model:stock.rule,name:sale_order_line_chained_move.sale_chained_out_customers_rule
23+
msgid "Out -> Customers"
24+
msgstr ""
25+
26+
#. module: sale_order_line_chained_move
27+
#: model:stock.rule,name:sale_order_line_chained_move.sale_chained_quality_out_rule
28+
msgid "Pack -> Out"
29+
msgstr ""
30+
31+
#. module: sale_order_line_chained_move
32+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_rule__preserve_separate_so_lines
33+
msgid "Preserve Separate Sale Order Lines"
34+
msgstr ""
35+
36+
#. module: sale_order_line_chained_move
37+
#: model:ir.model.fields,help:sale_order_line_chained_move.field_stock_rule__preserve_separate_so_lines
38+
msgid ""
39+
"Prevents Odoo's default behaviour of merging moves with the same product."
40+
msgstr ""
41+
42+
#. module: sale_order_line_chained_move
43+
#: model:product.product,name:sale_order_line_chained_move.product_product_two_steps
44+
#: model:product.template,name:sale_order_line_chained_move.product_product_two_steps_product_template
45+
msgid "Product Test Sale Chained Move"
46+
msgstr ""
47+
48+
#. module: sale_order_line_chained_move
49+
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_move__related_sale_line_id
50+
msgid "Related Sale Line"
51+
msgstr ""
52+
53+
#. module: sale_order_line_chained_move
54+
#: model:stock.location.route,name:sale_order_line_chained_move.route_product_sale_chained
55+
msgid "Route for Chained Sale Moves with Pack"
56+
msgstr ""
57+
58+
#. module: sale_order_line_chained_move
59+
#: model:ir.model,name:sale_order_line_chained_move.model_sale_order_line
60+
msgid "Sales Order Line"
61+
msgstr ""
62+
63+
#. module: sale_order_line_chained_move
64+
#: model:stock.rule,name:sale_order_line_chained_move.sale_chained_stock_out_rule
65+
msgid "Stock -> Pack"
66+
msgstr ""
67+
68+
#. module: sale_order_line_chained_move
69+
#: model:ir.model,name:sale_order_line_chained_move.model_stock_move
70+
msgid "Stock Move"
71+
msgstr ""
72+
73+
#. module: sale_order_line_chained_move
74+
#: model:ir.model,name:sale_order_line_chained_move.model_stock_rule
75+
msgid "Stock Rule"
76+
msgstr ""
77+
78+
#. module: sale_order_line_chained_move
79+
#: model:product.product,uom_name:sale_order_line_chained_move.product_product_two_steps
80+
#: model:product.template,uom_name:sale_order_line_chained_move.product_product_two_steps_product_template
81+
msgid "Units"
82+
msgstr ""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import sale_order_line
2+
from . import stock_move
3+
from . import stock_rule
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2021 ACSONE SA/NV
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class SaleOrderLine(models.Model):
8+
_inherit = "sale.order.line"
9+
10+
chained_move_ids = fields.One2many(
11+
comodel_name="stock.move",
12+
inverse_name="related_sale_line_id",
13+
)

0 commit comments

Comments
 (0)