From 920ada7054531f63bd9ee8cbc4bf84086c4b0d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 29 Jan 2016 15:41:18 +0100 Subject: [PATCH] [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. --- addons/website/models/website.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 5ab76974113..5582ba99e07 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -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)