Skip to content

Commit f59a967

Browse files
committed
[ADD] stock_move_disable_extra: do not split moves for excess quantities
1 parent f29a6e9 commit f59a967

File tree

16 files changed

+844
-0
lines changed

16 files changed

+844
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
===============================================
2+
Stock Move - Disable Extra for Lot Preservation
3+
===============================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:cfe660b0033e1d250163e3d7a3d74f2e87faf5d5676e52350d38fa45d4814aab
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
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%2Fstock--logistics--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_move_disable_extra
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-17-0/stock-logistics-workflow-17-0-stock_move_disable_extra
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=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
Adds an option on Operation Types to disable extra moves when receiving
32+
excess quantity.
33+
34+
Solves the problem of losing lot/serial tracking information when
35+
validating pickings with more quantity than demanded.
36+
37+
**Table of contents**
38+
39+
.. contents::
40+
:local:
41+
42+
Usage
43+
=====
44+
45+
# Usage
46+
47+
1. Create a receipt with Operation Type that has "Disable Extra Moves"
48+
enabled
49+
2. Enter lot/serial numbers for products
50+
3. Enter actual quantity received (may exceed demand)
51+
4. Validate the picking
52+
5. Excess quantity is processed with same lot information
53+
6. Check the "Excess Quantity" field on the stock move for reporting
54+
55+
Bug Tracker
56+
===========
57+
58+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
59+
In case of trouble, please check there if your issue has already been reported.
60+
If you spotted it first, help us to smash it by providing a detailed and welcomed
61+
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_move_disable_extra%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
62+
63+
Do not contact contributors directly about support or help with technical issues.
64+
65+
Credits
66+
=======
67+
68+
Authors
69+
-------
70+
71+
* Open Source Integrators
72+
73+
Contributors
74+
------------
75+
76+
- Open Source Integrators <https://www.opensourceintegrators.com>
77+
78+
- Daniel Reis <dreis@opensourceintegrators.com>
79+
80+
Maintainers
81+
-----------
82+
83+
This module is maintained by the OCA.
84+
85+
.. image:: https://odoo-community.org/logo.png
86+
:alt: Odoo Community Association
87+
:target: https://odoo-community.org
88+
89+
OCA, or the Odoo Community Association, is a nonprofit organization whose
90+
mission is to support the collaborative development of Odoo features and
91+
promote its widespread use.
92+
93+
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_move_disable_extra>`_ project on GitHub.
94+
95+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (C) 2026 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from . import models
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (C) 2026 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Stock Move - Disable Extra for Lot Preservation",
6+
"summary": "Add option to disable extra moves to preserve lot information "
7+
"on excess quantity",
8+
"version": "17.0.1.0.0",
9+
"category": "Stock",
10+
"website": "https://github.com/OCA/stock-logistics-workflow",
11+
"author": "Open Source Integrators, Odoo Community Association (OCA)",
12+
"license": "AGPL-3",
13+
"depends": ["stock"],
14+
"data": [
15+
"views/stock_picking_type_views.xml",
16+
"views/stock_move_views.xml",
17+
],
18+
"installable": True,
19+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (C) 2026 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from . import stock_picking_type
5+
from . import stock_move
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (C) 2026 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
from odoo.tools import float_compare
6+
7+
8+
class StockMove(models.Model):
9+
_inherit = "stock.move"
10+
11+
excess_quantity = fields.Float(
12+
help="Quantity received beyond the original demand",
13+
copy=False,
14+
)
15+
16+
def _create_extra_move(self):
17+
"""Override to check if extra moves are disabled on the picking type.
18+
If disabled, store excess quantity and return self without creating extra moves.
19+
"""
20+
# Check if extra moves are disabled for this picking type
21+
if self.picking_id and self.picking_id.picking_type_id.disable_extra_moves:
22+
# Store the excess quantity if any
23+
rounding = self.product_uom.rounding
24+
if (
25+
float_compare(
26+
self.quantity, self.product_uom_qty, precision_rounding=rounding
27+
)
28+
> 0
29+
):
30+
excess = self.quantity - self.product_uom_qty
31+
self.excess_quantity = excess
32+
# Return self instead of creating extra move
33+
return self
34+
35+
# Use the original logic if extra moves are not disabled
36+
return super()._create_extra_move()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (C) 2026 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class StockPickingType(models.Model):
8+
_inherit = "stock.picking.type"
9+
10+
disable_extra_moves = fields.Boolean(
11+
help="If checked, extra moves will not be created when receiving more quantity "
12+
"than demanded. This preserves lot/serial information but may affect "
13+
"push rules and backorder handling.",
14+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
1. Go to Inventory > Configuration > Operation Types
2+
2. Select or create an Operation Type
3+
3. Check the "Disable Extra Moves" checkbox
4+
4. Save
5+
6+
When enabled:
7+
- No extra moves are created for excess quantity
8+
- Lot/serial information is preserved
9+
- Excess quantity is stored in a dedicated field
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Open Source Integrators \<<https://www.opensourceintegrators.com>\>
2+
- Daniel Reis \<<dreis@opensourceintegrators.com>\>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Adds an option on Operation Types to disable extra moves when receiving
2+
excess quantity.
3+
4+
Solves the problem of losing lot/serial tracking information when
5+
validating pickings with more quantity than demanded.

0 commit comments

Comments
 (0)