[FIX] stock: avoid recomputing qty_to_order when not in scheduler
Configure a reorder rule and a restock route for a product A
Go to Inventory / Operations / Replenishment
Remove all filters, find product A and under column 'To Order' input a
quantity, then hit the button 'Order Once'
The user quantity will be overwritten by the '_compute_qty_to_order'.
This is a fine tuning of f505444655
opw-2375317
closes odoo/odoo#61952
X-original-commit: 0d4ab53b3f7400151105461973d54c6015550b2f
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -410,9 +410,6 @@ class StockWarehouseOrderpoint(models.Model):
|
||||
cr = registry(self._cr.dbname).cursor()
|
||||
self = self.with_env(self.env(cr=cr))
|
||||
orderpoints_batch = self.env['stock.warehouse.orderpoint'].browse(orderpoints_batch)
|
||||
# ensure that qty_* which depends on datetime.now() are correctly
|
||||
# recomputed
|
||||
orderpoints_batch._compute_qty_to_order()
|
||||
orderpoints_exceptions = []
|
||||
while orderpoints_batch:
|
||||
procurements = []
|
||||
|
||||
@@ -498,6 +498,9 @@ class ProcurementGroup(models.Model):
|
||||
# Minimum stock rules
|
||||
domain = self._get_orderpoint_domain(company_id=company_id)
|
||||
orderpoints = self.env['stock.warehouse.orderpoint'].search(domain)
|
||||
# ensure that qty_* which depends on datetime.now() are correctly
|
||||
# recomputed
|
||||
orderpoints.sudo()._compute_qty_to_order()
|
||||
orderpoints.sudo()._procure_orderpoint_confirm(use_new_cursor=use_new_cursor, company_id=company_id, raise_user_error=False)
|
||||
|
||||
# Search all confirmed stock_moves and try to assign them
|
||||
|
||||
Reference in New Issue
Block a user