diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py
index d3167bf7a53..5098601f358 100644
--- a/addons/mrp/models/mrp_production.py
+++ b/addons/mrp/models/mrp_production.py
@@ -57,7 +57,7 @@ class MrpProduction(models.Model):
product_qty = fields.Float(
'Quantity To Produce',
default=1.0, digits=dp.get_precision('Product Unit of Measure'),
- readonly=True, required=True,
+ readonly=True, required=True, track_visibility='onchange',
states={'confirmed': [('readonly', False)]})
product_uom_id = fields.Many2one(
'product.uom', 'Product Unit of Measure',
diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py
index 757f242aff1..c7d7111fd1b 100644
--- a/addons/mrp/models/stock_move.py
+++ b/addons/mrp/models/stock_move.py
@@ -32,11 +32,13 @@ class StockMoveLine(models.Model):
@api.multi
def write(self, vals):
- if 'lot_id' in vals:
- for movelot in self:
- movelot.move_id.production_id.move_raw_ids.mapped('move_line_ids')\
- .filtered(lambda r: r.done_wo and not r.done_move and r.lot_produced_id == movelot.lot_id)\
+ for move_line in self:
+ if move_line.production_id and 'lot_id' in vals:
+ move_line.production_id.move_raw_ids.mapped('move_line_ids')\
+ .filtered(lambda r: r.done_wo and not r.done_move and r.lot_produced_id == move_line.lot_id)\
.write({'lot_produced_id': vals['lot_id']})
+ if move_line.production_id and move_line.state == 'done' and any(field in vals for field in ('lot_id', 'location_id', 'qty_done')):
+ move_line._log_message(move_line.production_id, move_line, 'mrp.track_production_move_template', vals)
return super(StockMoveLine, self).write(vals)
diff --git a/addons/mrp/report/mrp_production_templates.xml b/addons/mrp/report/mrp_production_templates.xml
index 1dfead642db..17adf4858bb 100644
--- a/addons/mrp/report/mrp_production_templates.xml
+++ b/addons/mrp/report/mrp_production_templates.xml
@@ -89,4 +89,21 @@
+
+
+
+ Consumed
+
+
+ Produced
+
+ quantity has been updated.
+
+
+
+
+
+
+
+