Merge pull request #1021 from odoo-dev/saas-5-fix-routing-for-index-chm

[FIX] website: if the first menu referred to a website page and the route for this path is overwritten, the route is not used, the template has not the values of the route. (e.g. contact-us menu in first position if website_crm is installed)
[FIX] website_crm: the path '/crm/contactus' have an error if you doesn't use the website contact form or if you reload the page, instead of redirect to contact form.
This commit is contained in:
Christophe Matthieu 2014-07-09 13:30:17 +02:00
commit 407bb5d23e
2 changed files with 3 additions and 4 deletions

View File

@ -40,8 +40,7 @@ class Website(openerp.addons.web.controllers.main.Home):
if not (first_menu.url.startswith(('/page/', '/?', '/#')) or (first_menu.url=='/')):
return request.redirect(first_menu.url)
if first_menu.url.startswith('/page/'):
page = first_menu.url[6:]
return request.registry['ir.http'].reroute(first_menu.url)
return self.page(page)
@http.route(website=True, auth="public")

View File

@ -40,7 +40,7 @@ class contactus(http.Controller):
post_file = [] # List of file to add to ir_attachment once we have the ID
post_description = [] # Info to add after the message
values = {'user_id': False}
values = {}
lead_model = request.registry['crm.lead']
@ -81,7 +81,7 @@ class contactus(http.Controller):
post_description.append("%s: %s" % ("REFERER", environ.get("HTTP_REFERER")))
values['description'] += dict_to_str(_("Environ Fields: "), post_description)
lead_id = lead_model.create(request.cr, SUPERUSER_ID, values, request.context)
lead_id = lead_model.create(request.cr, SUPERUSER_ID, dict(values, user_id=False), request.context)
if lead_id:
for field_value in post_file:
attachment_value = {