[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
This commit is contained in:
Nicolas Martinelli
2018-03-27 08:24:33 +02:00
committed by Nicolas Martinelli
parent b07edf605b
commit e78a08e336
+11
View File
@@ -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'):