From fc699edb6c93e7701e9200b8355aa5190bed7556 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 5 Jan 2009 14:51:56 +0100 Subject: [PATCH] [IMP] account bzr revid: christophe@tinyerp.com-20090105135156-a8yh6v1bsl2k5u4k --- addons/account/account.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index d5cb84674ba..bbd88d10b2c 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1594,7 +1594,7 @@ class account_config_wizard(osv.osv_memory): ids=module_obj.search(cr, uid, [('category_id', '=', 'Account Charts'), ('state', '<>', 'installed')]) res=[(m.id, m.shortdesc) for m in module_obj.browse(cr, uid, ids)] res.append((-1, 'None')) - res.sort(lambda x,y: cmp(x[1],y[1])) + res.sort(key=lambda x: x[1]) return res _columns = { @@ -1621,25 +1621,12 @@ class account_config_wizard(osv.osv_memory): 'target':'new', } - def install_account_chart(self, cr, uid,ids, context=None): + def install_account_chart(self, cr, uid, ids, context=None): for res in self.read(cr,uid,ids): - id = res['charts'] - def install(id): + chart_id = res['charts'] + if chart_id > 0: mod_obj = self.pool.get('ir.module.module') - mod_obj.write(cr , uid, [id] ,{'state' : 'to install'}) - mod_obj.download(cr, uid, [id], context=context) - cr.commit() - cr.execute("select m.id as id from ir_module_module_dependency d inner join ir_module_module m on (m.name=d.name) where d.module_id=%s and m.state='uninstalled'",(id,)) - ret = cr.fetchall() - if len(ret): - for r in ret: - install(r[0]) - else: - mod_obj.write(cr , uid, [id] ,{'state' : 'to install'}) - mod_obj.download(cr, uid, [id], context=context) - cr.commit() - if id>0: - install(id) + mod_obj.button_install(cr, uid, [chart_id], context=context) cr.commit() db, pool = pooler.restart_pool(cr.dbname, update_module=True)