跳至内容
菜单
此问题已终结
5 回复
6798 查看

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?

形象
丢弃

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.

编写者 最佳答案

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.

形象
丢弃
最佳答案

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

Thanks.

形象
丢弃
最佳答案

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


形象
丢弃
最佳答案

same here..

形象
丢弃

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

最佳答案

Same problem here!

形象
丢弃
相关帖文 回复 查看 活动
0
9月 22
1451
2
2月 24
4977
3
5月 25
2854
0
5月 25
286
3
1月 25
2248