[FIX] website: singleton error while creating an order in website

When the user has contacts with different websites and tries to create an order,
a traceback will appear.

Steps to produce the error:
- Install 'website_sale' and 'contacts'
- Create 2 websites: 'Website A' and 'Website B'
- Go to Contacts > New > In Sales & Purchase, select 'Website A'
- Create another contact with 'Website B'
- Go to Website > eCommerce > Orders > New > try to enter Customer

Error: A traceback appears:
'Expected singleton: website(6, 16)'

https://github.com/odoo/odoo/blob/1cb866347eed8c43d1da225f441cc3b3ce9c5a01/addons/website/models/res_partner.py#L42
Here, instead of partner, self is used.
So when the user tries to create an order,
it will lead to above traceback.

sentry-4545021252

closes odoo/odoo#138929

X-original-commit: b053805d96c5fd8a9579e49b4f842f488c4adf60
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
Signed-off-by: Renilkumar Kajavadra (reka) <reka@odoo.com>
This commit is contained in:
Renilkumar Kajavadra
2023-10-19 05:36:56 +00:00
parent 743d8cd8c1
commit 4c1cab9e41
+1 -1
View File
@@ -39,4 +39,4 @@ class Partner(models.Model):
return
for partner in self:
if partner.website_id:
partner.display_name += f' [{self.website_id.name}]'
partner.display_name += f' [{partner.website_id.name}]'