diff --git a/openerp/addons/base/res/res_config.py b/openerp/addons/base/res/res_config.py index 548df0ec89e..2dedaccbc12 100644 --- a/openerp/addons/base/res/res_config.py +++ b/openerp/addons/base/res/res_config.py @@ -446,7 +446,7 @@ class res_config_settings(osv.osv_memory, res_config_module_installation_mixin): ir_module = self.pool['ir.module.module'] def ref(xml_id): mod, xml = xml_id.split('.', 1) - return ir_model_data.get_object(cr, uid, mod, xml, context=context, check_existence_and_raise=True) + return ir_model_data.get_object(cr, uid, mod, xml, context=context) defaults, groups, modules, others = [], [], [], [] for name, field in self._columns.items(): diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index bcce38ee3e3..43d3706d72d 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -681,8 +681,13 @@ class groups_view(osv.osv): def update_user_groups_view(self, cr, uid, context=None): # the view with id 'base.user_groups_view' inherits the user form view, # and introduces the reified group fields - view = self.get_user_groups_view(cr, uid, context) - if view: + # we have to try-catch this, because at first init the view does not exist + # but we are already creating some basic groups + try: + view = self.pool['ir.model.data'].get_object(cr, SUPERUSER_ID, 'base', 'user_groups_view', context=context, check_existence_and_raise=False) + except ValueError: + view = False + if view and view.exists() and view._table_name == 'ir.ui.view': xml1, xml2 = [], [] xml1.append(E.separator(string=_('Application'), colspan="4")) for app, kind, gs in self.get_groups_by_application(cr, uid, context): @@ -707,14 +712,6 @@ class groups_view(osv.osv): view.write({'arch': xml_content}) return True - def get_user_groups_view(self, cr, uid, context=None): - try: - view = self.pool['ir.model.data'].get_object(cr, SUPERUSER_ID, 'base', 'user_groups_view', context=context, check_existence_and_raise=False) - assert view and view.exists() and view._table_name == 'ir.ui.view' - except Exception: - view = False - return view - def get_application_groups(self, cr, uid, domain=None, context=None): return self.search(cr, uid, domain or [])