diff options
| author | Rémi Rahir <rar@odoo.com> | 2019-06-20 09:27:05 +0000 |
|---|---|---|
| committer | Rémi Rahir <rar@odoo.com> | 2019-06-20 10:17:00 +0000 |
| commit | 2ba7114047a858fc5731b6d190e7b14e935bcfaf (patch) | |
| tree | 26f44e51d4c62991e1ad11549513415fafc72e62 /addons | |
| parent | b59f3e4f99233c3af8f95cd95ee187f11cdb9830 (diff) | |
[FIX] website_sale: multi-website
The fix added in 3a0f05f3341aacad9be08736df787882addccfd4 doesn't work if an already existing user in company A
trys to modify his address on a website linked to company B. The form will try to change the company_id
of the res.partner which will then conflit with the company_id of the associated res.user, ultimately leading
to a UserError and a 500 error on the website.
opw-2025457
closes odoo/odoo#34262
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/website_sale/controllers/main.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 3411fb3e3b9..88a8bb27fa5 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -605,9 +605,12 @@ class WebsiteSale(ProductConfiguratorController): new_values['customer'] = True new_values['team_id'] = request.website.salesteam_id and request.website.salesteam_id.id new_values['user_id'] = request.website.salesperson_id and request.website.salesperson_id.id - new_values['company_id'] = request.website.company_id.id new_values['website_id'] = request.website.id + if order.partner_id.id == request.website.user_id.sudo().partner_id.id: + # If the partner is public, we assign the company of the website + new_values['company_id'] = request.website.company_id.id + lang = request.lang if request.lang in request.website.mapped('language_ids.code') else None if lang: new_values['lang'] = lang |
