[FIX] website: wrong computation of view
get_template should accept ids or xml ids. However the id or xml_id is given to IrUiView.get_view_id that waits for an xml_id. get_template crashed if it received an id. This commit solves this by setting view_id to the given id, or resolve the xml_id through get_view_id.
This commit is contained in:
committed by
Damien Bouvy
parent
a0bc204bb1
commit
920ada7054
@@ -393,10 +393,13 @@ class website(osv.osv):
|
||||
return Access.check(cr, uid, 'ir.ui.menu', 'read', False, context=context)
|
||||
|
||||
def get_template(self, cr, uid, ids, template, context=None):
|
||||
if not isinstance(template, (int, long)) and '.' not in template:
|
||||
template = 'website.%s' % template
|
||||
View = self.pool['ir.ui.view']
|
||||
view_id = View.get_view_id(cr, uid, template, context=context)
|
||||
if isinstance(template, (int, long)):
|
||||
view_id = template
|
||||
else:
|
||||
if '.' not in template:
|
||||
template = 'website.%s' % template
|
||||
view_id = View.get_view_id(cr, uid, template, context=context)
|
||||
if not view_id:
|
||||
raise NotFound
|
||||
return View.browse(cr, uid, view_id, context=context)
|
||||
|
||||
Reference in New Issue
Block a user