From 9d89b179c4eb7f567b19544b786064542e633733 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 15 Jan 2015 23:16:33 +0100 Subject: [PATCH] [FIX] website: search a matching route with http method POST When url_for was looking for a route which match, it was only looking for GET route. So routes which were restricted to be used only with a POST method, were never found. The result was that urls in website for route post (form in most cases) was never prefixed with the lang. So the request.lang was always the default lang from website... If you was creating a sale order (in ecommerce), the lang used in sale order was wrong and the description not in the current lang. --- addons/website/models/website.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 809391f9ccf..006e6c4a10f 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -77,7 +77,8 @@ def is_multilang_url(local_url, langs=None): path = url[0] query_string = url[1] if len(url) > 1 else None router = request.httprequest.app.get_db_router(request.db).bind('') - func = router.match(path, query_args=query_string)[0] + # Force to check method to POST. Odoo uses methods : ['POST'] and ['GET', 'POST'] + func = router.match(path, method='POST', query_args=query_string)[0] return func.routing.get('website', False) and func.routing.get('multilang', True) except Exception: return False