From 3bc7ea6bcf3a53281b7b0d01b94caf83f121284c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 29 Feb 2016 18:25:49 -0700 Subject: [PATCH] [FIX] stock: stock valuation user timezone date When delivering a delivery order (`stock.picking.out`), which generates accounting entries e.g. thanks to the real-time stock valuation, the date of the move set was the UTC today date, while it must be the user's today date, using the timezone passed in the context. This prevented the delivery of the `stock.picking.out` when the `Check date in period` boolean was checked in the stock journal, and the user date is in the previous month compared to the UTC date, as the date set on the move entries were not in the selected period for these move entries. e.g. When the user timezone is UTC -8, and his current time is 2016-02-29 18:00:00, the UTC date is 2016-03-01 02:00:00, the period chosen is February (correct), but the date on the move entries were set to 2016-03-01. opw-670820 --- addons/stock/stock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index e8cdbca3105..f43b877ec60 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2500,7 +2500,7 @@ class stock_move(osv.osv): 'product_id': move.product_id and move.product_id.id or False, 'quantity': move.product_qty, 'ref': move.picking_id and move.picking_id.name or False, - 'date': time.strftime('%Y-%m-%d'), + 'date': fields.date.context_today(self, cr, uid), 'partner_id': partner_id, 'debit': reference_amount, 'account_id': dest_account_id, @@ -2510,7 +2510,7 @@ class stock_move(osv.osv): 'product_id': move.product_id and move.product_id.id or False, 'quantity': move.product_qty, 'ref': move.picking_id and move.picking_id.name or False, - 'date': time.strftime('%Y-%m-%d'), + 'date': fields.date.context_today(self, cr, uid), 'partner_id': partner_id, 'credit': reference_amount, 'account_id': src_account_id,