summaryrefslogtreecommitdiff
path: root/addons/stock
diff options
context:
space:
mode:
authoryhu-odoo <yhu@odoo.com>2021-02-17 15:04:33 +0000
committeryhu-odoo <yhu@odoo.com>2021-02-18 07:48:57 +0000
commit04424cddf1e28a52fd7df3ad954d2d484b52972e (patch)
treef1dfcae32ea8e9b91c017a0664df749a2badc0b4 /addons/stock
parent5051e890f213cfe604e1cb7c604119ed0cbc38d8 (diff)
[FIX] stock: disable auto-reserve with ir.config_parameter
Currently we always auto-reserve products for moves when other incoming picking makes the product available. This is unwanted for some users. In this commit, we allow to disable this by add a parameter to ir.config_parameter. To disable it, set a parameter with name "stock.picking_no_auto_reserve". PR #66373 Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Diffstat (limited to 'addons/stock')
-rw-r--r--addons/stock/models/stock_move.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py
index b2a29ac529e..55d19ddff53 100644
--- a/addons/stock/models/stock_move.py
+++ b/addons/stock/models/stock_move.py
@@ -1772,7 +1772,12 @@ class StockMove(models.Model):
orderpoints._procure_orderpoint_confirm(company_id=company, raise_user_error=False)
def _trigger_assign(self):
- """ Check for and trigger action_assign for confirmed/partially_available moves related to done moves. """
+ """ Check for and trigger action_assign for confirmed/partially_available moves related to done moves.
+ Disable auto reservation if user configured to do so.
+ """
+ if not self or self.env['ir.config_parameter'].sudo().get_param('stock.picking_no_auto_reserve'):
+ return
+
domains = []
for move in self:
domains.append([('product_id', '=', move.product_id.id), ('location_id', '=', move.location_dest_id.id)])