[FIX] website_sale: multi-website
The fix added in 3a0f05f334 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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user