From efc8992a52e8f2f78a60cb640240c416f55501eb Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Tue, 2 Aug 2011 14:10:05 +0530 Subject: [PATCH] [IMP] Made context_date + date variable outside the for loop and improved the variable names bzr revid: bde@tinyerp.com-20110802084005-vd891ebsio62i2s7 --- addons/account/account.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 8e653bd5d93..a5734138dd3 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2120,10 +2120,10 @@ class account_model(osv.osv): raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !')) period_id = period_id[0] + move_date = context.get('date', time.strftime('%Y-%m-%d')) + move_date = datetime.strptime(move_date,"%Y-%m-%d") for model in self.browse(cr, uid, ids, context=context): - context_date = context.get('date') - date = datetime.strptime(context_date,"%Y-%m-%d") - entry['name'] = model.name%{'year':date.strftime("%Y"), 'month':date.strftime("%m"), 'date': date.strftime("%Y-%m")} + entry['name'] = model.name%{'year':move_date.strftime("%Y"), 'month':move_date.strftime("%m"), 'date': move_date.strftime("%Y-%m")} move_id = account_move_obj.create(cr, uid, { 'ref': entry['name'], 'period_id': period_id,