From d497f5c6e979971f6221480b3578714f0b07ee72 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 2 Jun 2010 15:06:25 +0200 Subject: [PATCH] [FIX] Define the local variable 'res' bzr revid: stephane@openerp.com-20100602130625-0xl1sqo57h6f0kue --- addons/account/account.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 04a0bb5da68..61319f7f973 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1965,13 +1965,12 @@ class account_add_tmpl_wizard(osv.osv_memory): if not tids or not tids[0]['parent_id']: return False ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]],['code']) + res = None if not ptids or not ptids[0]['code']: raise osv.except_osv(_('Error !'), _('Cannot locate parent code for template account!')) res = acc_obj.search(cr,uid,[('code','=',ptids[0]['code'])]) - if res: - return res[0] - else: - return False + + return res and res[0] or False _columns = { 'cparent_id':fields.many2one('account.account', 'Parent target', help="Creates an account with the selected template under this existing parent.", required=True),