Skip to Content
Menu
This question has been flagged

Hey guys

I have an odoo website with website_sale installed. My language of the logged in user is set to nl_NL. The active language on my website is English, this is the only active language on my website.

Now, whenever I log in using my nl_NL user I can browse to every page without trouble.

BUT when I click a product in the shop, my url gets modified to [base.url]/[user.lang]/shop/product/sc-123.

I expected this to not add my user.lang and just redirect me to /shop/product/sc-123.

I cannot find where this gets prepended to my url. The <a> element I click does not have to nl_NL in the href, I can confirm that!

I really hope someone here can guide me to a solution!
Thanks in advance

Avatar
Discard
Best Answer

Hi SonnyV

The place were the change on the URL is taking place is on addons/website/models/ir_http.py on the _dispatch method and it happens when you have more than one language enabled for your website and because the controller route for the url have website=True, that will cause to redirect the url with the lang injected. This also will break ajax request since it will not follow that kind of redirects

the route in your case have this notation in the website_sale:

@http.route(['/shop/product/<model("product.template"):product>'], type='http', auth="public", website=True)
def product(self, product, category='', search='', **kwargs):

To disable it just inherit that controller to remove the argument website=True

Avatar
Discard
Related Posts Replies Views Activity
0
Feb 21
2991
2
Feb 18
6511
0
Feb 18
2418
3
Jun 17
4956
0
Jan 16
3164