[FIX] mrp: restrict _post_process_scheduler search domain

stock.orderpoint._post_process_scheduler confirms
productions after procurements have been run.

This was introduced to avoid conflict between
procurements, conflicts that can happen e.g. in
the purchase_mrp module.

However, currently action_confirm might
also be called on done or cancelled productions.
That can happen if there are already been lots
of procurements for the same product/orderpoint,
i.e. MO with the same values have been created multiple times.

To avoid this, add ('state', '=', 'draft' in the search_domain.

opw-2666960

closes odoo/odoo#79437

X-original-commit: 11c7b92f90804a4d73833e22c071e1665058fbdb
Signed-off-by: Arnold Moyaux <arm@odoo.com>
This commit is contained in:
Aurélien (avd)
2021-11-05 16:51:51 +00:00
parent 9320b1b4f1
commit f74eb30709
+1
View File
@@ -106,5 +106,6 @@ class StockWarehouseOrderpoint(models.Model):
self.env['mrp.production'].sudo().search([
('orderpoint_id', 'in', self.ids),
('move_raw_ids', '!=', False),
('state', '=', 'draft'),
]).action_confirm()
return super()._post_process_scheduler()