Skip to content

Commit 896c758

Browse files
ShideEmilioPascual
authored andcommitted
[ADD] stock_move_not_merge_by_dest_moves
1 parent b7ff263 commit 896c758

File tree

17 files changed

+1135
-0
lines changed

17 files changed

+1135
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../stock_move_not_merge_by_dest_moves
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)
Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
==============================================
2+
Stock Move - Do not merge by destination moves
3+
==============================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:a311da309386ceedb823109235a3fa327387cb289077f53dc442bcd2262d179f
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Alpha
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_move_not_merge_by_dest_moves
21+
:alt: OCA/stock-logistics-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_move_not_merge_by_dest_moves
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/stock-logistics-workflow&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module extends the functionality of stock move merging to allow you
32+
to never merge stock moves if those moves will go to different
33+
destination moves.
34+
35+
.. IMPORTANT::
36+
This is an alpha version, the data model and design can change at any time without warning.
37+
Only for development or testing purpose, do not use in production.
38+
`More details on development status <https://odoo-community.org/page/development-status>`_
39+
40+
**Table of contents**
41+
42+
.. contents::
43+
:local:
44+
45+
Use Cases / Context
46+
===================
47+
48+
This module was developed because sometimes we don't want our stock
49+
movements to be merged if goes to different moves because:
50+
51+
- Sale free products that must be invoiced separatelly (for example, get
52+
2 + 1 free)
53+
- Use warehouse with 2 or 3 steps in Outgoing Shipments
54+
- Use products with Invoicing Policy: Delivered Quantities
55+
56+
All of these conditions must be met for this module to be really useful.
57+
58+
Use case example:
59+
-----------------
60+
61+
We have an order with two lines of the same product that need to be
62+
weighed (kg) and the offer is "get 2 + 1 free".
63+
64+
Each piece of Fish measures aproximately 1kg and we assume you know how
65+
many Fishes you need to take.
66+
67+
The lines of the sale would be like this:
68+
69+
- 2 pieces of Fish for aproximately 2kg in total.
70+
- 1 piece of Fish for aproximately 1kg in total with 100% discount.
71+
72+
Odoo Core VS. Module: Workflow comparison
73+
-----------------------------------------
74+
75+
+----------------------------------+----------------------------------+
76+
| **Odoo Core** | **With this module** |
77+
+==================================+==================================+
78+
| The OUT step will not be | The OUT step will not be |
79+
| grouped, so we will have 2 | grouped, so we will have 2 |
80+
| moves. | moves. |
81+
+----------------------------------+----------------------------------+
82+
| | |
83+
+----------------------------------+----------------------------------+
84+
| The PICK step will be grouped | Since we have 2 separate moves |
85+
| into one line, telling you that | on the OUT step, we don't want |
86+
| 3 kgs must be demanded | to merge moves in the PICK step. |
87+
| | PICK step will tell you that |
88+
| | 3kgs must be demanded into 2 |
89+
| | separate moves. |
90+
+----------------------------------+----------------------------------+
91+
| | |
92+
+----------------------------------+----------------------------------+
93+
| When you measure the 3 fishes in | When you measure the 3 fishes in |
94+
| the PICK step, we get 1.9kg for | the PICK step, we get 1.9kg for |
95+
| the 2 Fishes and 0.7kg for the | the 2 Fishes and 0.7kg for the |
96+
| free Fish. 2.6kg in total. | free Fish. 2.6kg in total. |
97+
+----------------------------------+----------------------------------+
98+
| | |
99+
+----------------------------------+----------------------------------+
100+
| Confirm the PICK step. When you | Confirm the PICK step. When you |
101+
| reserve quantities on OUTGOING | reserve quantities on OUTGOING |
102+
| step, 2kg will go to the 2 | step, 1.9kg will go to the 2 |
103+
| Fishes and 0.6kg to the free | Fishes and 0.7kg to the free |
104+
| Fish. | Fish. |
105+
+----------------------------------+----------------------------------+
106+
| | |
107+
+----------------------------------+----------------------------------+
108+
| Your invoice to the customer | Your invoice to the customer |
109+
| will be 2kg for the 2 pieces and | will be 1.9kg for the 2 pieces |
110+
| 0.6kg for the free fish. | and 0.7kg for the free fish. |
111+
+----------------------------------+----------------------------------+
112+
| | |
113+
+----------------------------------+----------------------------------+
114+
| This is not correct: The 2 pices | This is correct |
115+
| of Fish should be invoiced for | |
116+
| 1.9kg and the free fish should | |
117+
| be invoiced for 0.7kg at 100% | |
118+
| discount. | |
119+
+----------------------------------+----------------------------------+
120+
121+
If you also don't want to have to reweigh in the last step if you
122+
exceeded the quantity demanded (Fishes weight 1.14kg each for example),
123+
you might be interested in this module:
124+
125+
- stock_rule_reserve_max_quantity
126+
127+
Usage
128+
=====
129+
130+
To use this module, you need to have activated sales module:
131+
132+
1. Activate sale module.
133+
2. Go to Warehouse and activate 2 steps shipping process.
134+
3. Create and confirm a sale with 2 lines: One with discount and one
135+
without discount with the same product.
136+
4. Confirm the sale.
137+
5. Check the first picking (PICK) moves is not grouped.
138+
6. Set quantity done on each line that differs (below) the reserved
139+
quantity on PICK picking and confirm it.
140+
7. Go to the OUT picking, and check how quantities are distributed
141+
correctly.
142+
143+
Known issues / Roadmap
144+
======================
145+
146+
- Receipts (second step quantities not correct)
147+
148+
Symptom: After testing receipts, the quantities shown/propagated in
149+
the second step are not correct (they do not match what was processed
150+
in the first step, or the distribution per move is inconsistent).
151+
152+
Source: Video “Moduon - Review Gelo [16.0][ADD]
153+
stock_move_not_merge_by_dest_moves #2014”.
154+
https://www.loom.com/share/416b1efb65d04c5d80acd9fac2bf4e0f?sid=8084079a-d28b-4b04-9839-cf3544cddc42
155+
156+
Expected: The second-step document should reflect the quantities done
157+
in the first step, line by line / per destination move, without over-
158+
or under-allocation. Actual: The second-step quantities differ from
159+
the first step and/or are misallocated. Status: Under investigation.
160+
161+
- Sales (SO line changes not updated on picking)
162+
163+
Symptom: After confirming a Sales Order, changes made on the SO line
164+
are not propagated to the generated picking.
165+
166+
Source: Video “Moduon - Review Gelo [16.0][ADD]
167+
stock_move_not_merge_by_dest_moves #2014 sales”.
168+
https://www.loom.com/share/8dfe51327d6d435f8dbdcef4af9ce77b?sid=424232ef-c392-4903-8d42-0254da24c812
169+
170+
Expected: Updates on the SO line (e.g., quantity/discount that affect
171+
downstream moves) should be reflected on the generated picking.
172+
Actual: The picking does not refresh after SO line changes. Status:
173+
Under investigation.
174+
175+
Bug Tracker
176+
===========
177+
178+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
179+
In case of trouble, please check there if your issue has already been reported.
180+
If you spotted it first, help us to smash it by providing a detailed and welcomed
181+
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_move_not_merge_by_dest_moves%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
182+
183+
Do not contact contributors directly about support or help with technical issues.
184+
185+
Credits
186+
=======
187+
188+
Authors
189+
-------
190+
191+
* Moduon
192+
193+
Contributors
194+
------------
195+
196+
- Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
197+
- Rafael Blasco (`Moduon <https://www.moduon.team/>`__)
198+
199+
Other credits
200+
-------------
201+
202+
The development of this module has been financially supported by:
203+
204+
- Ulzama
205+
206+
Maintainers
207+
-----------
208+
209+
This module is maintained by the OCA.
210+
211+
.. image:: https://odoo-community.org/logo.png
212+
:alt: Odoo Community Association
213+
:target: https://odoo-community.org
214+
215+
OCA, or the Odoo Community Association, is a nonprofit organization whose
216+
mission is to support the collaborative development of Odoo features and
217+
promote its widespread use.
218+
219+
.. |maintainer-Shide| image:: https://github.com/Shide.png?size=40px
220+
:target: https://github.com/Shide
221+
:alt: Shide
222+
.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px
223+
:target: https://github.com/rafaelbn
224+
:alt: rafaelbn
225+
226+
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
227+
228+
|maintainer-Shide| |maintainer-rafaelbn|
229+
230+
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_move_not_merge_by_dest_moves>`_ project on GitHub.
231+
232+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2025 Moduon Team S.L.
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)
3+
4+
{
5+
"name": "Stock Move - Do not merge by destination moves",
6+
"summary": "Do not merge stock moves that go to different destination moves",
7+
"version": "16.0.1.0.0",
8+
"development_status": "Alpha",
9+
"category": "Inventory/Inventory",
10+
"website": "https://github.com/OCA/stock-logistics-workflow",
11+
"author": "Moduon, Odoo Community Association (OCA)",
12+
"maintainers": ["Shide", "rafaelbn"],
13+
"license": "LGPL-3",
14+
"application": False,
15+
"installable": True,
16+
"depends": [
17+
"sale_stock",
18+
],
19+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import stock_move
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2025 Moduon Team S.L.
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)
3+
4+
from odoo import api, models
5+
6+
7+
class StockMove(models.Model):
8+
_inherit = "stock.move"
9+
10+
@api.model
11+
def _prepare_merge_moves_distinct_fields(self):
12+
"""Do not merge moves that goes to different destination moves"""
13+
fields = super()._prepare_merge_moves_distinct_fields()
14+
fields.append("move_dest_ids")
15+
return fields
16+
17+
@api.model
18+
def _prepare_merge_negative_moves_excluded_distinct_fields(self):
19+
"""Merge negative moves that goes to same destination moves"""
20+
fields = super()._prepare_merge_negative_moves_excluded_distinct_fields()
21+
fields.append("move_dest_ids")
22+
return fields
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This module was developed because sometimes we don't want our stock movements to be merged if goes to different moves because:
2+
- Sale free products that must be invoiced separatelly (for example, get 2 + 1 free)
3+
- Use warehouse with 2 or 3 steps in Outgoing Shipments
4+
- Use products with Invoicing Policy: Delivered Quantities
5+
6+
All of these conditions must be met for this module to be really useful.
7+
8+
## Use case example:
9+
10+
We have an order with two lines of the same product that need to be weighed (kg) and the offer is "get 2 + 1 free".
11+
12+
Each piece of Fish measures aproximately 1kg and we assume you know how many Fishes you need to take.
13+
14+
The lines of the sale would be like this:
15+
- 2 pieces of Fish for aproximately 2kg in total.
16+
- 1 piece of Fish for aproximately 1kg in total with 100% discount.
17+
18+
## Odoo Core VS. Module: Workflow comparison
19+
20+
| **Odoo Core** | **With this module** |
21+
|---|---|
22+
| The OUT step will not be grouped, so we will have 2 moves. | The OUT step will not be grouped, so we will have 2 moves. |
23+
| | |
24+
| The PICK step will be grouped into one line, telling you that 3 kgs must be demanded | Since we have 2 separate moves on the OUT step, we don't want to merge moves in the PICK step. PICK step will tell you that 3kgs must be demanded into 2 separate moves. |
25+
| | |
26+
| When you measure the 3 fishes in the PICK step, we get 1.9kg for the 2 Fishes and 0.7kg for the free Fish. 2.6kg in total. | When you measure the 3 fishes in the PICK step, we get 1.9kg for the 2 Fishes and 0.7kg for the free Fish. 2.6kg in total. |
27+
| | |
28+
| Confirm the PICK step. When you reserve quantities on OUTGOING step, 2kg will go to the 2 Fishes and 0.6kg to the free Fish. | Confirm the PICK step. When you reserve quantities on OUTGOING step, 1.9kg will go to the 2 Fishes and 0.7kg to the free Fish. |
29+
| | |
30+
| Your invoice to the customer will be 2kg for the 2 pieces and 0.6kg for the free fish. | Your invoice to the customer will be 1.9kg for the 2 pieces and 0.7kg for the free fish. |
31+
| | |
32+
| This is not correct: The 2 pices of Fish should be invoiced for 1.9kg and the free fish should be invoiced for 0.7kg at 100% discount. | This is correct |
33+
34+
35+
If you also don't want to have to reweigh in the last step if you exceeded the quantity demanded (Fishes weight 1.14kg each for example), you might be interested in this module:
36+
- stock_rule_reserve_max_quantity
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Eduardo de Miguel ([Moduon](https://www.moduon.team/))
2+
- Rafael Blasco ([Moduon](https://www.moduon.team/))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The development of this module has been financially supported by:
2+
3+
- Ulzama

0 commit comments

Comments
 (0)