[FIX] website: Handle multiple homepage with same url and no website

Issue

	- Install website
	- Go to Website->Configuration->Pages
	- Group By "View"
	- Open and edit "Home" view of "My Website 2"
	- Remove "Website" value and save
	- It should list 2 same views for same url and no website
	  under one of the "Home" views
	- Go to Configurations->Settings
	- Create a new website

	Traceback is thrown.

Cause

	When fetching default homepage,
	it retrieve more then one pages and then try
	to assign it as homepage to new website.

Solution

	Limit query to one to get only one homepage.

opw-2252208

closes odoo/odoo#51280

X-original-commit: 0698f3b0ccddf77a6c0c02812bb823da2d21b265
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
Nasreddin (bon)
2020-05-14 15:52:24 +00:00
parent 7b714a3bc7
commit ba7e7002f8
+1 -1
View File
@@ -256,7 +256,7 @@ class Website(models.Model):
homepage_page = Page.search([
('website_id', '=', self.id),
('key', '=', standard_homepage.key),
])
], limit=1)
if not homepage_page:
homepage_page = Page.create({
'website_published': True,