[FIX] stock: run scheduler on partially available moves
1. Product A - on stock 5 pcs. 2. SO - 7 pcs. of A 3. Generated picking has reserved 5 pcs. 4. Increase stock to 7 pcs. (Update qty on Hand) 5. Run procurement scheduler 6. Picking still has reserved 5 pcs. The scheduler should take into account the moves partially available. Fixes #27874 opw-1895622 closes odoo/odoo#28136
This commit is contained in:
@@ -237,8 +237,10 @@ class ProcurementGroup(models.Model):
|
||||
self.sudo()._procure_orderpoint_confirm(use_new_cursor=use_new_cursor, company_id=company_id)
|
||||
|
||||
# Search all confirmed stock_moves and try to assign them
|
||||
confirmed_moves = self.env['stock.move'].search([('state', '=', 'confirmed'), ('product_uom_qty', '!=', 0.0)], limit=None, order='priority desc, date_expected asc')
|
||||
for moves_chunk in split_every(100, confirmed_moves.ids):
|
||||
moves_to_assign = self.env['stock.move'].search([
|
||||
('state', 'in', ['confirmed', 'partially_available']), ('product_uom_qty', '!=', 0.0)
|
||||
], limit=None, order='priority desc, date_expected asc')
|
||||
for moves_chunk in split_every(100, moves_to_assign.ids):
|
||||
self.env['stock.move'].browse(moves_chunk)._action_assign()
|
||||
if use_new_cursor:
|
||||
self._cr.commit()
|
||||
|
||||
Reference in New Issue
Block a user