[FIX] ir.model.data more faithful backward compatibilty

bzr revid: al@openerp.com-20140129032053-nb5x1oll6mkpw86h
This commit is contained in:
Antony Lesuisse 2014-01-29 04:20:53 +01:00
parent 928f25a4f1
commit 9aed30381e
2 changed files with 3 additions and 7 deletions

View File

@ -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:

View File

@ -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"))