Set effective_date also for assigned moves
This commit is contained in:
1 parent
fb612624fd
commit
89d64faf2d
1 file changed
+4
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user