diff options
| author | Jeremy Kersten <jke@odoo.com> | 2019-11-15 08:19:43 +0000 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2019-11-26 14:35:46 +0000 |
| commit | dc77f67cad95d0b0bd316cbdfc36a380f2daf73d (patch) | |
| tree | 2a72a21f498ca6f984af7f230852a62a5f5ecfe5 /addons/test_website/controllers/main.py | |
| parent | ef0488ef91161eba5267ea29fa5c6b379c483f29 (diff) | |
[FIX] website: match get/post in is_multilang_url
Old heuristic is not more True:
Force to check method to POST. Odoo uses methods : ['POST'] and ['GET', 'POST']
We have some controller that only allow 'GET' method, so we need to check GET
also when we try to know if an url is multilang or not.
This commit fix case where a controller '/test' only allow GET and you were in
another language that the default, in this case, the rendered url in qweb was
/get instead of /<lang>/get.
Closes #37223
closes odoo/odoo#40519
X-original-commit: c7650106f8588083be12812600a6c94ba703fd6f
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/test_website/controllers/main.py')
| -rw-r--r-- | addons/test_website/controllers/main.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/test_website/controllers/main.py b/addons/test_website/controllers/main.py index b95dfddd2a1..1973e363653 100644 --- a/addons/test_website/controllers/main.py +++ b/addons/test_website/controllers/main.py @@ -103,3 +103,19 @@ class WebsiteTest(Home): @http.route('/test_access_denied_http', type='http', auth='public', website=True, sitemap=False) def test_denied_error_http(self, **kwargs): raise AccessDenied("This is an access denied http test") + + @http.route(['/get'], type='http', auth="public", methods=['GET'], website=True, sitemap=False) + def get_method(self, **kw): + return request.make_response('get') + + @http.route(['/post'], type='http', auth="public", methods=['POST'], website=True, sitemap=False) + def post_method(self, **kw): + return request.make_response('post') + + @http.route(['/get_post'], type='http', auth="public", methods=['GET', 'POST'], website=True, sitemap=False) + def get_post_method(self, **kw): + return request.make_response('get_post') + + @http.route(['/get_post_nomultilang'], type='http', auth="public", methods=['GET', 'POST'], website=True, multilang=False, sitemap=False) + def get_post_method_no_multilang(self, **kw): + return request.make_response('get_post_nomultilang') |
