Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4779 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lut 21
3587
2
lut 18
6971
0
lut 18
2827
3
cze 17
5632
0
sty 16
3669