[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:
Thibault Delavallée
2016-02-01 12:00:44 +01:00
parent dc043cf1bb
commit 051fb278b9
+6 -3
View File
@@ -406,10 +406,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)