diff --git a/move.py b/move.py index e72225dcbc..2c29e7a5b7 100644 --- a/move.py +++ b/move.py @@ -455,6 +455,9 @@ class Move(OSV): product = product_obj.browse(cursor, user, vals['product'], context=context) vals['cost_price'] = product.cost_price + elif vals.get('state') == 'assigned': + if not vals.get('effective_date'): + vals['effective_date'] = datetime.date.today() return super(Move, self).create(cursor, user, vals, context=context) def write(self, cursor, user, ids, vals, context=None): @@ -491,6 +494,7 @@ class Move(OSV): if move.state in ('cancel', 'done'): self.raise_user_error(cursor, 'set_state_assigned', context=context) + vals['effective_date'] = datetime.date.today() elif vals['state'] == 'done': if move.state in ('cancel'): self.raise_user_error(cursor, 'set_state_done',