mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
fix: Sider and indexing (minor)
This commit is contained in:
@@ -8,7 +8,6 @@ import json
|
|||||||
import itertools
|
import itertools
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
|
||||||
from frappe.website.render import clear_cache
|
|
||||||
from frappe.website.website_generator import WebsiteGenerator
|
from frappe.website.website_generator import WebsiteGenerator
|
||||||
from frappe.utils import cstr, random_string, cint, flt
|
from frappe.utils import cstr, random_string, cint, flt
|
||||||
|
|
||||||
@@ -359,3 +358,7 @@ def make_website_item(doc):
|
|||||||
|
|
||||||
website_item.save()
|
website_item.save()
|
||||||
return [website_item.name, website_item.web_item_name]
|
return [website_item.name, website_item.web_item_name]
|
||||||
|
|
||||||
|
def on_doctype_update():
|
||||||
|
# since route is a Text column, it needs a length for indexing
|
||||||
|
frappe.db.add_index("Website Item", ["route(500)"])
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
frappe.ui.form.on('Homepage', {
|
frappe.ui.form.on('Homepage', {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
frm.fields_dict["products"].grid.get_field("item").get_query = function(){
|
frm.fields_dict["products"].grid.get_field("item").get_query = function() {
|
||||||
return {
|
return {
|
||||||
filters: {'published': 1}
|
filters: {'published': 1}
|
||||||
}
|
}
|
||||||
@@ -21,9 +21,9 @@ frappe.ui.form.on('Homepage', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on('Homepage Featured Product', {
|
frappe.ui.form.on('Homepage Featured Product', {
|
||||||
view: function(frm, cdt, cdn){
|
view: function(frm, cdt, cdn) {
|
||||||
var child= locals[cdt][cdn]
|
var child= locals[cdt][cdn];
|
||||||
if(child.item_code && child.route){
|
if (child.item_code && child.route) {
|
||||||
window.open('/' + child.route, '_blank');
|
window.open('/' + child.route, '_blank');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -370,7 +370,6 @@ class Item(Document):
|
|||||||
|
|
||||||
if self.published_in_website:
|
if self.published_in_website:
|
||||||
invalidate_cache_for_item(self)
|
invalidate_cache_for_item(self)
|
||||||
clear_cache(self.route)
|
|
||||||
|
|
||||||
frappe.db.set_value("Item", new_name, "item_code", new_name)
|
frappe.db.set_value("Item", new_name, "item_code", new_name)
|
||||||
|
|
||||||
@@ -957,7 +956,3 @@ def update_variants(variants, template, publish_progress=True):
|
|||||||
count+=1
|
count+=1
|
||||||
if publish_progress:
|
if publish_progress:
|
||||||
frappe.publish_progress(count*100/len(variants), title = _("Updating Variants..."))
|
frappe.publish_progress(count*100/len(variants), title = _("Updating Variants..."))
|
||||||
|
|
||||||
def on_doctype_update():
|
|
||||||
# since route is a Text column, it needs a length for indexing
|
|
||||||
frappe.db.add_index("Item", ["route(500)"])
|
|
||||||
|
|||||||
Reference in New Issue
Block a user