summaryrefslogtreecommitdiff
path: root/addons/website/controllers
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2016-01-08 23:16:25 +0100
committerJeremy Kersten <jke@odoo.com>2016-01-08 23:19:29 +0100
commitce3f7970686c5658c3fd72a67d5ee06ce61849d1 (patch)
tree489725d52bed27e8acc21f1693c5ff8543d4e8c5 /addons/website/controllers
parent2afadfe444ec52acec5d7890cda5ae6817604999 (diff)
[FIX] website_event: avoid traceback when page doesn't exists
The controller /event/<event_id>/page/<page> raise exception if page is not existing. Allow to pass the template reference when user are creating a new page. Without it, it is impossible for the end user to create a website_event page without change manually the xml id because the xml id is based on the module from the template. This fix is retro compatible, because from_template will be ignored until next update of website. And during update from website, website_event will be updated because it's a dependance and so the default_page template created.
Diffstat (limited to 'addons/website/controllers')
-rw-r--r--addons/website/controllers/main.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py
index 182d05c3c51..c44ae20e117 100644
--- a/addons/website/controllers/main.py
+++ b/addons/website/controllers/main.py
@@ -180,8 +180,11 @@ class Website(openerp.addons.web.controllers.main.Home):
# Edit
#------------------------------------------------------
@http.route('/website/add/<path:path>', type='http', auth="user", website=True)
- def pagenew(self, path, noredirect=False, add_menu=None):
- xml_id = request.registry['website'].new_page(request.cr, request.uid, path, context=request.context)
+ def pagenew(self, path, noredirect=False, add_menu=None, template=False):
+ if template:
+ xml_id = request.registry['website'].new_page(request.cr, request.uid, path, template=template, context=request.context)
+ else:
+ xml_id = request.registry['website'].new_page(request.cr, request.uid, path, context=request.context)
if add_menu:
request.registry['website.menu'].create(
request.cr, request.uid, {