Skip to Content
Menu
This question has been flagged
5 Replies
6757 Views

We're hosting multiple websites on SH (same database) each with different brands and customer bases and have been running into issues with the web.base.url parameter.

The ecommerce website in this example is a secondary site. The web.base.url parameter is set as the principal site. When a checkout is concluded on the 2nd ecommerce site, Odoo automatically redirects to the third-party gateway via the principal website domain which seems to invalidate the CRSF token and also creates anxiety to the customer who doesn't understand why they are being taken to this other website instead of the payment portal.

I understand that the web.base.url.freeze parameter can be set to "True" to define the URL used without resetting but my question is what is the solution to isolate these domains when you are running multiple websites each with their own checkouts, payment gateways and assets without crossing over?

Avatar
Discard

Hello. I would like to know if your problem was solved. It happens to me exactly the same?. Can you help me? Thanks


Any answer? This is so silly. I hardly even understand what web.base.url even does. I want all my websites to work individually. Is that that hard? Isn't that the behavior everyone on the planet would *expect*?

Hello, did you find a workarround to this problem? I am facing the same issue.

Author Best Answer

Until now we haven't found any solution and will probably require a lot of customization of the modules susceptible to problems (eg. the payment gateway module we are using). I understand that a lot of records can be isolated to specific websites within the backend, but where the web.base.url is used it can cause problems.

To mention another example is when links are sent via email to customers and this parameter is used. That being said the workaround will be to identify these specific examples and treat them with some customization. A lot of work for what should be a native behaviour in my opinion.

Avatar
Discard
Best Answer

I also face the same problem! Did you find the solution? Can you share with us?

Thanks.

Avatar
Discard
Best Answer

I solve this problem overriding signup_url method. 

Requisite: you have to assign a specific website to the partner (linked to portal user).

Original:

def _get_signup_url_for_action(self, url=None, action=None, view_type=None, menu_id=None, res_id=None, model=None):

...

signup_url = "/web/%s?%s" % (route, werkzeug.urls.url_encode(query))
if not self.env.context.get('relative_url'):
signup_url = werkzeug.urls.url_join(base_url, signup_url)
res[partner.id] = signup_url

return res

My code:

signup_url = "/web/%s?%s" % (route, werkzeug.urls.url_encode(query))
if not self.env.context.get('relative_url'):
# this three lines make the magic, we ask if the contact has a specific website assigned,

# so we use partner_id.website_id.domain instead base_url from database parameters.

if partner.website_id:
signup_url = werkzeug.urls.url_join(partner.website_id.domain, signup_url)
else:

signup_url = werkzeug.urls.url_join(base_url, signup_url)
res[partner.id] = signup_url

return res


Avatar
Discard
Best Answer

same here..

Avatar
Discard

check my answer above ;) (March 18th 2023)

Gracias Marco.

 

Podemos hablar. Estamos buscando un desarrollador de odoo.

 

Saludos.

 

César López

leanspots

 

From: Marco Villagrana Escobedo <notifications@mail.odoo.com>
Date: Sunday, 19 March 2023 at 03:28
To: César <cesar@leanspots.com>
Subject: Re: web.base.url and Multi-sites

check my answer above ;) (March 18th 2023) ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Odoo Inc.


Ver Mensaje del foro

  

web.base.url and Multi-sites

  


check my answer above ;) (March 18th 2023)

--
Marco Villagrana Escobedo


Odoo Inc.

+1 650-691-3277 | info@odoo.com | https://www.odoo.com

Con tecnología de Odoo

Best Answer

Same problem here!

Avatar
Discard
Related Posts Replies Views Activity
0
Sep 22
1429
2
Feb 24
4961
3
May 25
2731
0
May 25
210
3
Jan 25
2177