From 89d64faf2d657a3e82b147f9c3c41a8f523dbbbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 26 Jan 2009 19:08:38 +0100 Subject: [PATCH] Set effective_date also for assigned moves --- move.py | 4 ++++ 1 file changed, 4 insertions(+) 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',