Merge pull request #22736 from Thunderbottom/set-homepage

fix: reset homepage to home after unchecking products page
This commit is contained in:
Deepesh Garg 2020-07-23 18:53:37 +05:30 committed by GitHub
commit 718870f4a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,9 +11,9 @@ from frappe.model.document import Document
class ProductsSettings(Document):
def validate(self):
if self.home_page_is_products:
website_settings = frappe.get_doc('Website Settings')
website_settings.home_page = 'products'
website_settings.save()
frappe.db.set_value("Website Settings", "home_page", "products")
elif frappe.db.get_single_value("Website Settings", "home_page") == 'products':
frappe.db.set_value("Website Settings", "home_page", "home")
self.validate_field_filters()
self.validate_attribute_filters()
@ -40,4 +40,3 @@ def home_page_is_products(doc, method):
home_page_is_products = cint(frappe.db.get_single_value('Products Settings', 'home_page_is_products'))
if home_page_is_products:
doc.home_page = 'products'