From d281e7aebd58904e68ee4ac1dadf9866acc2b4bd Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 10 Apr 2015 09:50:28 +0200 Subject: [PATCH] [FIX] stock_account: avoid timezone periode mismatch The `find` method will get the current accounting periode according to the user's timezone while time do not. This means that it is possible that users get a move with a date belongign to a different period that the one returned by `find`. Fixing b101808, linked to #4147, courtesy of Graeme Gellatly --- addons/stock_account/stock_account.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index 06745a02f28..d1a66610264 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -22,8 +22,6 @@ from openerp.osv import fields, osv from openerp.tools.translate import _ from openerp import SUPERUSER_ID, api -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT -import time import logging _logger = logging.getLogger(__name__) @@ -251,7 +249,7 @@ class stock_quant(osv.osv): move_obj.create(cr, uid, {'journal_id': journal_id, 'line_id': move_lines, 'period_id': period_id, - 'date': time.strftime(DEFAULT_SERVER_DATE_FORMAT), + 'date': fields.date.context_today(self, cr, uid, context=context), 'ref': move.picking_id.name}, context=context) #def _reconcile_single_negative_quant(self, cr, uid, to_solve_quant, quant, quant_neg, qty, context=None):