From 8ff7d299f57e5d8eed9c55ff33e4e600aa3d476f Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 5 Feb 2015 15:03:16 +0100 Subject: [PATCH] [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 --- addons/stock/stock.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index bcc3e22f791..b58eca5ccb9 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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):