mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-14 18:51:21 +00:00
fix: Sider and Patch tests
This commit is contained in:
@@ -132,12 +132,14 @@ class ECommerceSettings(Document):
|
|||||||
|
|
||||||
def on_change(self):
|
def on_change(self):
|
||||||
old_doc = self.get_doc_before_save()
|
old_doc = self.get_doc_before_save()
|
||||||
old_fields = old_doc.search_index_fields
|
|
||||||
new_fields = self.search_index_fields
|
|
||||||
|
|
||||||
# if search index fields get changed
|
if old_doc:
|
||||||
if not (new_fields == old_fields):
|
old_fields = old_doc.search_index_fields
|
||||||
create_website_items_index()
|
new_fields = self.search_index_fields
|
||||||
|
|
||||||
|
# if search index fields get changed
|
||||||
|
if not (new_fields == old_fields):
|
||||||
|
create_website_items_index()
|
||||||
|
|
||||||
def validate_cart_settings(doc, method):
|
def validate_cart_settings(doc, method):
|
||||||
frappe.get_doc("E Commerce Settings", "E Commerce Settings").run_method("validate")
|
frappe.get_doc("E Commerce Settings", "E Commerce Settings").run_method("validate")
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ erpnext.ProductSearch = class {
|
|||||||
bindSearchAction() {
|
bindSearchAction() {
|
||||||
let me = this;
|
let me = this;
|
||||||
|
|
||||||
this.searchBox.on("focus", (e) => {
|
this.searchBox.on("focus", () => {
|
||||||
this.search_dropdown.removeClass("hidden");
|
this.search_dropdown.removeClass("hidden");
|
||||||
});
|
});
|
||||||
|
|
||||||
this.searchBox.on("focusout", (e) => {
|
this.searchBox.on("focusout", () => {
|
||||||
this.search_dropdown.addClass("hidden");
|
this.search_dropdown.addClass("hidden");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ erpnext.ProductSearch = class {
|
|||||||
query: query
|
query: query
|
||||||
},
|
},
|
||||||
callback: (data) => {
|
callback: (data) => {
|
||||||
me.populateCategoriesList(data)
|
me.populateCategoriesList(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -211,16 +211,16 @@ erpnext.ProductSearch = class {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let html = ""
|
let html = "";
|
||||||
let search_results = data.message.results
|
let search_results = data.message.results;
|
||||||
search_results.forEach((category) => {
|
search_results.forEach((category) => {
|
||||||
html += `
|
html += `
|
||||||
<div class="mb-2" style="font-weight: 400;">
|
<div class="mb-2" style="font-weight: 400;">
|
||||||
<a href="/${category.route}">${category.name}</a>
|
<a href="/${category.route}">${category.name}</a>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
})
|
});
|
||||||
|
|
||||||
this.category_container.html(html);
|
this.category_container.html(html);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
@@ -120,7 +120,7 @@ def delete_item_from_index(website_item_doc):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
cache.delete(key)
|
cache.delete(key)
|
||||||
except:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
delete_from_ac_dict(website_item_doc)
|
delete_from_ac_dict(website_item_doc)
|
||||||
@@ -152,7 +152,7 @@ def define_autocomplete_dictionary():
|
|||||||
try:
|
try:
|
||||||
cache.delete(make_key(WEBSITE_ITEM_NAME_AUTOCOMPLETE))
|
cache.delete(make_key(WEBSITE_ITEM_NAME_AUTOCOMPLETE))
|
||||||
cache.delete(make_key(WEBSITE_ITEM_CATEGORY_AUTOCOMPLETE))
|
cache.delete(make_key(WEBSITE_ITEM_CATEGORY_AUTOCOMPLETE))
|
||||||
except:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
items = frappe.get_all(
|
items = frappe.get_all(
|
||||||
|
|||||||
@@ -70,13 +70,14 @@ def get_category_records(categories):
|
|||||||
if frappe.get_meta(doctype, cached=True).get_field("image"):
|
if frappe.get_meta(doctype, cached=True).get_field("image"):
|
||||||
fields += ["image"]
|
fields += ["image"]
|
||||||
|
|
||||||
categorical_data[category] = frappe.db.sql(f"""
|
categorical_data[category] = frappe.db.sql(
|
||||||
Select
|
f"""
|
||||||
{",".join(fields)}
|
Select
|
||||||
from
|
{",".join(fields)}
|
||||||
`tab{doctype}`""",
|
from
|
||||||
as_dict=1
|
`tab{doctype}`
|
||||||
)
|
""",
|
||||||
|
as_dict=1)
|
||||||
|
|
||||||
return categorical_data
|
return categorical_data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user