[FIX] mrp: hide detail operations button on MO draft

Since the user can't input quantity done on stock move without
tracking. He shouldn't be able to do it for tracked products.
This commit is contained in:
William Henrotin
2020-08-03 09:18:34 +00:00
parent b924320a29
commit eae0042e27
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -475,7 +475,7 @@ class MrpProduction(models.Model):
production.state = 'progress'
elif not float_is_zero(production.qty_producing, precision_rounding=production.product_uom_id.rounding):
production.state = 'progress'
elif any(not float_is_zero(move.quantity_done, precision_rounding=move.product_uom.rounding) for move in production.move_raw_ids) :
elif any(not float_is_zero(move.quantity_done, precision_rounding=move.product_uom.rounding or move.product_id.uom_id.rounding) for move in production.move_raw_ids):
production.state = 'progress'
else:
production.state = 'confirmed'
+4 -1
View File
@@ -415,8 +415,11 @@ class StockMove(models.Model):
def _show_details_in_draft(self):
self.ensure_one()
if self.raw_material_production_id and self.state == 'draft':
production = self.raw_material_production_id or self.production_id
if production and (self.state != 'draft' or production.state != 'draft'):
return True
elif production:
return False
else:
return super()._show_details_in_draft()