From bb81e4ccd7b0044bbe1ad45842a3f799ceac0838 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Wed, 26 Jun 2019 09:25:47 +0000 Subject: [PATCH] [FIX] website_sale: avoid adding website on customer when not needed Before this commit, when an address would be edited or created from checkout, we would always add a website_id on it. (values_postprocess -> _checkout_form_save) That would be incorrect if the website has not 'specific user account' enabled. It would lead to an error as the user would not be able to connect to another website. Indeed, the billing address is stored on the partner directly. Since the res.user website_id is a related to the partner one, the user would then be restricted to that website. Closes #34396 Fixes #34308 --- addons/website_sale/controllers/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 88a8bb27fa5..8b37915e6be 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -605,7 +605,9 @@ 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['website_id'] = request.website.id + + if request.website.specific_user_account: + 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