From 9aed30381e528de8d890e697db946c9baf1d341e Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Wed, 29 Jan 2014 04:20:53 +0100 Subject: [PATCH] [FIX] ir.model.data more faithful backward compatibilty bzr revid: al@openerp.com-20140129032053-nb5x1oll6mkpw86h --- openerp/addons/base/ir/ir_model.py | 8 ++------ openerp/addons/base/res/res_users.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index 014d6948683..5021c607d8e 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -918,16 +918,12 @@ class ir_model_data(osv.osv): raise ValueError('Not enough access rights on the external ID: %s.%s' % (module, xml_id)) return model, False - def get_object(self, cr, uid, module, xml_id, context=None, raise_exception=True): + def get_object(self, cr, uid, module, xml_id, context=None): """ Returns a browsable record for the given module name and xml_id. If not found, raise a ValueError or return a browse_null, depending on the value of `raise_exception`. - - :param raise_exception: when true, check whether record exists and - raise a ValueError if it does not; otherwise return a browse_null - or non-existing record. """ - return self.xmlid_to_object(cr, uid, "%s.%s" % (module, xml_id), raise_if_not_found=raise_exception, context=context) + return self.xmlid_to_object(cr, uid, "%s.%s" % (module, xml_id), raise_if_not_found=True, context=context) def _update_dummy(self,cr, uid, model, module, xml_id=False, store=True): if not xml_id: diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index 9201b11114f..ad017381409 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -685,7 +685,7 @@ class groups_view(osv.osv): # and introduces the reified group fields # we have to try-catch this, because at first init the view does not exist # but we are already creating some basic groups - view = self.pool['ir.model.data'].get_object(cr, SUPERUSER_ID, 'base', 'user_groups_view', context=context, raise_exception=False) + view = self.pool['ir.model.data'].xmlid_to_object(cr, SUPERUSER_ID, 'base.user_groups_view', context=context) if view and view.exists() and view._table_name == 'ir.ui.view': xml1, xml2 = [], [] xml1.append(E.separator(string=_('Application'), colspan="4"))