summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Henrotin <whe@odoo.com>2020-08-03 09:18:34 +0000
committerWilliam Henrotin <whe@odoo.com>2020-08-03 09:18:34 +0000
commiteae0042e27642014ee5ea9b99f30daaebeb8a04b (patch)
treedd6d9085df4027d7b6f1a36735c682801543e1c3
parentb924320a29045e4b49d3f0a2aa04b3842f641c15 (diff)
[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.
-rw-r--r--addons/mrp/models/mrp_production.py2
-rw-r--r--addons/mrp/models/stock_move.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py
index fd598626482..6f4613ff8e8 100644
--- a/addons/mrp/models/mrp_production.py
+++ b/addons/mrp/models/mrp_production.py
@@ -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'
diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py
index 4e21aec49fc..294b2feeee9 100644
--- a/addons/mrp/models/stock_move.py
+++ b/addons/mrp/models/stock_move.py
@@ -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()