From e78a08e33659702c4fec78f16ca7338b7d4c50d9 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 26 Mar 2018 11:23:59 +0200 Subject: [PATCH] [FIX] mrp: date expected - Create a MO - Change the date 'Deadline Start' The corresponding 'Expected Date' on the stock moves is not updated with the new value. opw-1828631 --- addons/mrp/models/mrp_production.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 162e83b015f..16325a98500 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -263,6 +263,17 @@ class MrpProduction(models.Model): self.location_src_id = self.picking_type_id.default_location_src_id.id or location.id self.location_dest_id = self.picking_type_id.default_location_dest_id.id or location.id + @api.multi + def write (self, vals): + res = super(MrpProduction, self).write(vals) + if 'date_planned_start' in vals: + moves = (self.mapped('move_raw_ids') + self.mapped('move_finished_ids')).filtered( + lambda r: r.state not in ['done', 'cancel']) + moves.write({ + 'date_expected': vals['date_planned_start'], + }) + return res + @api.model def create(self, values): if not values.get('name', False) or values['name'] == _('New'):