Skip to content
Snippets Groups Projects
Commit 356f3563 authored by Yolann Sabaux's avatar Yolann Sabaux
Browse files

[FIX] website_sale: multi-company payment methods


Steps to reproduce:
- Have a portal user with a related contact (thus on the contact, partner_share is True)
- Set a default company A on the user, and the same company A on the sales tab on the contact (so the company_id field is A)
- Have a website linked to company B
- Connect to said website with the portal user
- Try to buy something

Issue:
Internal error - Multi company issue

Solution:
It is mainly a configuration error but the message is not user firendly.
Instead we make sure the partner cn proceed a transaction in the company website

opw-2734190

closes odoo/odoo#101722

Signed-off-by: default avatarWilliam Braeckman (wbr) <wbr@odoo.com>
parent d1695527
No related branches found
No related tags found
No related merge requests found
......@@ -887,6 +887,12 @@ class WebsiteSale(http.Controller):
return_url= '/shop/payment/validate',
bootstrap_formatting= True
)
if order.partner_id.company_id and order.partner_id.company_id.id != order.company_id.id:
values['errors'].append(
(_('Sorry, we are unable to find a Payment Method'),
_('No payment method is available for your current order. '
'Please contact us for more information.')))
return values
domain = expression.AND([
['&', ('state', 'in', ['enabled', 'test']), ('company_id', '=', order.company_id.id)],
......
......@@ -1665,6 +1665,14 @@ msgstr ""
msgid "No abandoned carts found"
msgstr ""
#. module: website_sale
#: code:addons/website_sale/controllers/main.py:0
#, python-format
msgid ""
"No payment method is available for your current order. Please contact us for"
" more information."
msgstr ""
#. module: website_sale
#: model_terms:ir.ui.view,arch_db:website_sale.products
msgid "No product defined"
......@@ -2629,6 +2637,12 @@ msgstr ""
msgid "Some required fields are empty."
msgstr ""
#. module: website_sale
#: code:addons/website_sale/controllers/main.py:0
#, python-format
msgid "Sorry, we are unable to find a Payment Method"
msgstr ""
#. module: website_sale
#: model_terms:ir.ui.view,arch_db:website_sale.sort
msgid "Sort by"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment