From a69af9c908da34786f7b8267b79665d9540a033f Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 3 Sep 2015 11:57:58 +0200 Subject: [PATCH] [FIX] addons: propagate context when get sequence With 3e82c94d we use the timezone in the context to format date sequences when formatting an ir.sequence. This commit adds the other missing context when getting a sequence, so these sequences are also dependant on the timezone. closes #8351 opw-646487 --- addons/account/account_bank_statement.py | 2 +- addons/analytic/analytic.py | 2 +- addons/point_of_sale/point_of_sale.py | 2 +- addons/purchase/purchase.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index e9c1b5a3758..6bd6f76dab0 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -944,7 +944,7 @@ class account_bank_statement_line(osv.osv): 'currency_id': fields.many2one('res.currency', 'Currency', help="The optional other currency if it is a multi-currency entry."), } _defaults = { - 'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'), + 'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line', context=context), 'date': lambda self,cr,uid,context={}: context.get('date', fields.date.context_today(self,cr,uid,context=context)), } diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 975b8d6b63a..136489cb621 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -251,7 +251,7 @@ class account_analytic_account(osv.osv): _defaults = { 'type': 'normal', 'company_id': _default_company, - 'code' : lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'account.analytic.account'), + 'code' : lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'account.analytic.account', context=context), 'state': 'open', 'user_id': lambda self, cr, uid, ctx: uid, 'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False), diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 5ba591b39a7..fdb64a665bd 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -1380,7 +1380,7 @@ class pos_order_line(osv.osv): } _defaults = { - 'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'pos.order.line'), + 'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'pos.order.line', context=context), 'qty': lambda *a: 1, 'discount': lambda *a: 0.0, 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index c5f985f8b82..91f465bbdce 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -343,7 +343,7 @@ class purchase_order(osv.osv): def create(self, cr, uid, vals, context=None): if vals.get('name','/')=='/': - vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'purchase.order') or '/' + vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'purchase.order', context=context) or '/' context = dict(context or {}, mail_create_nolog=True) order = super(purchase_order, self).create(cr, uid, vals, context=context) self.message_post(cr, uid, [order], body=_("RFQ created"), context=context) @@ -1522,7 +1522,7 @@ class procurement_order(osv.osv): po_line_id = po_line_obj.create(cr, SUPERUSER_ID, line_vals, context=context) linked_po_ids.append(procurement.id) else: - name = seq_obj.get(cr, uid, 'purchase.order') or _('PO: %s') % procurement.name + name = seq_obj.get(cr, uid, 'purchase.order', context=context) or _('PO: %s') % procurement.name po_vals = { 'name': name, 'origin': procurement.origin,