chore: Remove `Home Page is Products` and Sider fixes
- Removed `Home Page is Products` checkbox in E Comm Settings. Can be manually set in Website Settings
- Removed hooks trigger to reset home page as products
- Sider: duplicate color attribute, shift `return` to next line, over-indentation
diff --git a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json
index 54e88ca..abc1c4e 100644
--- a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json
+++ b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json
@@ -5,8 +5,6 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
- "home_page_is_products",
- "column_break_4",
"products_per_page",
"display_settings_section",
"hide_variants",
@@ -60,13 +58,6 @@
],
"fields": [
{
- "default": "0",
- "description": "If checked, the Home page will be the default Item Group for the website",
- "fieldname": "home_page_is_products",
- "fieldtype": "Check",
- "label": "Home Page is Products"
- },
- {
"default": "6",
"fieldname": "products_per_page",
"fieldtype": "Int",
@@ -85,10 +76,6 @@
"label": "Hide Variants"
},
{
- "fieldname": "column_break_4",
- "fieldtype": "Column Break"
- },
- {
"default": "0",
"description": "The field filters will also work as categories in the <b>Shop by Category</b> page.",
"fieldname": "enable_field_filters",
@@ -392,7 +379,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
- "modified": "2021-07-15 16:50:50.087281",
+ "modified": "2021-08-24 13:40:15.294696",
"modified_by": "Administrator",
"module": "E-commerce",
"name": "E Commerce Settings",
diff --git a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.py b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.py
index 1b59873..1e54146 100644
--- a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.py
+++ b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.py
@@ -17,11 +17,6 @@
self.is_redisearch_loaded = is_search_module_loaded()
def validate(self):
- if self.home_page_is_products:
- frappe.db.set_value("Website Settings", None, "home_page", "products")
- elif frappe.db.get_single_value("Website Settings", "home_page") == 'products':
- frappe.db.set_value("Website Settings", None, "home_page", "home")
-
self.validate_field_filters()
self.validate_attribute_filters()
self.validate_checkout()
@@ -163,9 +158,3 @@
def show_attachments():
return get_shopping_cart_settings().show_attachments
-
-def home_page_is_products(doc, method):
- """Called on saving Website Settings."""
- home_page_is_products = cint(frappe.db.get_single_value("E Commerce Settings", "home_page_is_products"))
- if home_page_is_products:
- doc.home_page = "products"
\ No newline at end of file
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index b364b2f..3eb6ce7 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -241,9 +241,6 @@
("Sales Taxes and Charges Template", "Price List"): {
"on_update": "erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings.validate_cart_settings"
},
- "Website Settings": {
- "validate": "erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings.home_page_is_products"
- },
"Tax Category": {
"validate": "erpnext.regional.india.utils.validate_tax_category"
},
diff --git a/erpnext/patches/v13_0/populate_e_commerce_settings.py b/erpnext/patches/v13_0/populate_e_commerce_settings.py
index 5ce7acb..1565ac2 100644
--- a/erpnext/patches/v13_0/populate_e_commerce_settings.py
+++ b/erpnext/patches/v13_0/populate_e_commerce_settings.py
@@ -8,7 +8,7 @@
frappe.reload_doc("portal", "doctype", "website_attribute")
products_settings_fields = [
- "hide_variants", "home_page_is_products", "products_per_page",
+ "hide_variants", "products_per_page",
"enable_attribute_filters", "enable_field_filters"
]
diff --git a/erpnext/public/scss/shopping_cart.scss b/erpnext/public/scss/shopping_cart.scss
index bfca3f4..7753378 100644
--- a/erpnext/public/scss/shopping_cart.scss
+++ b/erpnext/public/scss/shopping_cart.scss
@@ -811,7 +811,6 @@
.cart-btn {
border: none;
background: var(--gray-100);
- color: var(--gray-500);
box-shadow: none;
width: 24px;
height: 28px;
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 52e3b40..5b8b96e 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -254,7 +254,8 @@
else:
changed[field] = self.get(field)
- if not changed: return
+ if not changed:
+ return
web_item_doc = frappe.get_doc("Website Item", web_item)
web_item_doc.update(changed)
@@ -462,16 +463,16 @@
def validate_properties_before_merge(self, new_name):
# Validate properties before merging
- if not frappe.db.exists("Item", new_name):
- frappe.throw(_("Item {0} does not exist").format(new_name))
+ if not frappe.db.exists("Item", new_name):
+ frappe.throw(_("Item {0} does not exist").format(new_name))
- field_list = ["stock_uom", "is_stock_item", "has_serial_no", "has_batch_no"]
- new_properties = [cstr(d) for d in frappe.db.get_value("Item", new_name, field_list)]
+ field_list = ["stock_uom", "is_stock_item", "has_serial_no", "has_batch_no"]
+ new_properties = [cstr(d) for d in frappe.db.get_value("Item", new_name, field_list)]
- if new_properties != [cstr(self.get(field)) for field in field_list]:
- msg = _("To merge, following properties must be same for both items")
- msg += ": \n" + ", ".join([self.meta.get_label(fld) for fld in field_list])
- frappe.throw(msg, title=_("Cannot Merge"), exc=DataValidationError)
+ if new_properties != [cstr(self.get(field)) for field in field_list]:
+ msg = _("To merge, following properties must be same for both items")
+ msg += ": \n" + ", ".join([self.meta.get_label(fld) for fld in field_list])
+ frappe.throw(msg, title=_("Cannot Merge"), exc=DataValidationError)
def validate_duplicate_website_item_before_merge(self, old_name, new_name):
"""