[fix] Website Image validation

This commit is contained in:
Nabin Hait 2015-12-11 11:47:05 +05:30
parent a1a712b0c6
commit fc4eca5cc7

View File

@ -89,6 +89,7 @@ class Item(WebsiteGenerator):
auto_set_website_image = True
self.website_image = self.image
if self.website_image:
file = frappe.db.get_value("File", filters={
"file_url": self.website_image,
"attached_to_doctype": self.doctype,
@ -96,9 +97,10 @@ class Item(WebsiteGenerator):
}, fieldname=["name", "is_private"], as_dict=True)
if not file:
self.website_image = None
if not auto_set_website_image:
frappe.msgprint(_("Website Image {0} attached to Item {1} cannot be found").format(self.website_image, self.name))
frappe.msgprint(_("Website Image {0} attached to Item {1} cannot be found")
.format(self.website_image, self.name))
self.website_image = None
elif file.is_private:
self.website_image = None