[enhancement] use thumbnails in grid views, patch to make thumbnails

This commit is contained in:
Rushabh Mehta
2015-10-07 14:30:19 +05:30
parent 73e73795f1
commit 6e322d0a02
11 changed files with 67 additions and 8 deletions

View File

@@ -0,0 +1,14 @@
import frappe
def execute():
frappe.reload_doctype("File")
frappe.reload_doctype("Item")
for item in frappe.get_all("Item", fields=("name", "website_image")):
if item.website_image:
item_doc = frappe.get_doc("Item", item.name)
try:
item_doc.make_thumbnail()
if item_doc.thumbnail:
item_doc.db_set("thumbnail", item_doc.thumbnail)
except Exception:
print "Unable to make thumbnail for {0}".format(item.website_image)