summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ledoux <dle@odoo.com>2015-02-05 15:03:16 +0100
committerDenis Ledoux <dle@odoo.com>2015-02-05 15:04:58 +0100
commit8ff7d299f57e5d8eed9c55ff33e4e600aa3d476f (patch)
tree9afa42c3aab03b2c3e350b0e321f18b611e4dd70
parentd7f30de9ae8a432c95fbd87e0ffbf8057b85992f (diff)
[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
-rw-r--r--addons/stock/stock.py8
1 files changed, 7 insertions, 1 deletions
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):