From e34769a59d517e4206225e9e37c225b61b9c63c6 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 16 Nov 2010 17:06:07 +0200 Subject: [PATCH] module wizards: improve over trivial rpc errors bzr revid: p_christ@hol.gr-20101116150607-qh03n3w225j6xh8v --- bin/addons/base/module/wizard/base_language_install.py | 4 +++- bin/addons/base/module/wizard/base_update_translations.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/addons/base/module/wizard/base_language_install.py b/bin/addons/base/module/wizard/base_language_install.py index 9cdae41ad2b..f7b469f85ed 100644 --- a/bin/addons/base/module/wizard/base_language_install.py +++ b/bin/addons/base/module/wizard/base_language_install.py @@ -38,7 +38,9 @@ class base_language_install(osv.osv_memory): 'state': 'init', 'overwrite': False } - def lang_install(self, cr, uid, ids, context): + def lang_install(self, cr, uid, ids, context=None): + if context is None: + context = {} language_obj = self.browse(cr, uid, ids)[0] lang = language_obj.lang if lang: diff --git a/bin/addons/base/module/wizard/base_update_translations.py b/bin/addons/base/module/wizard/base_update_translations.py index b413e9d7093..6b329cf1212 100644 --- a/bin/addons/base/module/wizard/base_update_translations.py +++ b/bin/addons/base/module/wizard/base_update_translations.py @@ -35,7 +35,7 @@ class base_update_translations(osv.osv_memory): lang_obj=pooler.get_pool(cr.dbname).get('res.lang') ids=lang_obj.search(cr, uid, [('code', '=', lang_code)]) if not ids: - raise osv.except_osv(_('No language with code "%s" exists') % lang_code) + raise osv.except_osv(_('Error!'), _('No language with code "%s" exists') % lang_code) lang = lang_obj.browse(cr, uid, ids[0]) return lang.name def act_cancel(self, cr, uid, ids, context=None): @@ -51,12 +51,14 @@ class base_update_translations(osv.osv_memory): return {'type': 'ir.actions.act_window_close'} def default_get(self, cr, uid, fields, context=None): + if context is None: + context = {} res = super(base_update_translations, self).default_get(cr, uid, fields, context=context) if context.get('active_model') != "res.lang": return res - record_id = context and context.get('active_id', False) or False + record_id = context.get('active_id', False) or False if record_id: lang = self.pool.get('res.lang').browse(cr, uid, record_id).code res.update(lang=lang)