[FIX] stock: picking, Set date of reception if not set by user previously

If the date_done field of the model stock.picking is already filled in
it means the user do wanted to have this date of reception date
instead of the moment when the user clicked the receive button.

opw-627219
This commit is contained in:
Denis Ledoux
2015-02-05 15:04:58 +01:00
parent d7f30de9ae
commit 8ff7d299f5
+7 -1
View File
@@ -884,7 +884,13 @@ class stock_picking(osv.osv):
This method is called at the end of the workflow by the activity "done".
@return: True
"""
self.write(cr, uid, ids, {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')})
for picking in self.browse(cr, uid, ids, context=context):
values = {
'state': 'done'
}
if not picking.date_done:
values['date_done'] = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
self.write(cr, uid, ids, values, context=context)
return True
def action_move(self, cr, uid, ids, context=None):