Skip to content
Snippets Groups Projects
Commit 0d4ab53b authored by Andrea Grazioso (agr-odoo)'s avatar Andrea Grazioso (agr-odoo)
Browse files

[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 f5054446

opw-2375317

closes odoo/odoo#61884

Signed-off-by: default avataragr-odoo <agr-odoo@users.noreply.github.com>
parent d66063ea
Branches
Tags
No related merge requests found
......@@ -409,9 +409,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 = []
......
......@@ -497,6 +497,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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment