[FIX] mrp: bypass flexible consumption check in immediate production

Case:
  - create a MO for 3 units
  - produce only one but with more than a third of the components
  - the flexible consumption wizard is triggered, accept and make the
  backorder.
  - Mark as done the backorder, the immediate production wizard is
  triggered, accept it.

-> the flexible wizard is triggered again as the components quantity do
not respect the BoM. In this specific case, we want to consume all the
remaining component so we would like to avoid the flexible warning.

Task : 2278147
This commit is contained in:
William Henrotin
2020-08-10 09:40:24 +00:00
parent 18dddc2027
commit 22be775cdc
+1 -1
View File
@@ -1205,7 +1205,7 @@ class MrpProduction(models.Model):
:rtype: list
"""
issues = []
if self.env.context.get('skip_consumption', False):
if self.env.context.get('skip_consumption', False) or self.env.context.get('skip_immediate', False):
return issues
for order in self:
if order.consumption == 'flexible' or not order.bom_id or not order.bom_id.bom_line_ids: