From 5c76492fbe8b6872bf95ce718bd473166cdd9afa Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 23 Jul 2013 11:48:25 +0530 Subject: [PATCH] [minor] [fix] clear value and run trigger of attach_files: field on removing attachment, if that attachment is being used by a given field --- stock/doctype/item/item.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js index b1bb26902e..9af8331d0b 100644 --- a/stock/doctype/item/item.js +++ b/stock/doctype/item/item.js @@ -182,13 +182,6 @@ cur_frm.fields_dict.item_supplier_details.grid.get_field("supplier").get_query = function(doc,cdt,cdn) { return{ query:"controllers.queries.supplier_query" } } -cur_frm.cscript.on_remove_attachment = function(doc) { - if(!inList(cur_frm.fields_dict.image.df.options.split("\n"), doc.image)) { - msgprint(wn._("Attachment removed. You may need to update: ") - + wn.meta.get_docfield(doc.doctype, "description_html").label); - } -}; - cur_frm.cscript.copy_from_item_group = function(doc) { wn.model.with_doc("Item Group", doc.item_group, function() { $.each(wn.model.get("Item Website Specification", {parent:doc.item_group}), @@ -206,5 +199,10 @@ cur_frm.cscript.copy_from_item_group = function(doc) { cur_frm.cscript.image = function() { refresh_field("image_view"); - if(!cur_frm.doc.description_html) cur_frm.cscript.add_image(cur_frm.doc); + if(!cur_frm.doc.description_html) { + cur_frm.cscript.add_image(cur_frm.doc); + } else { + msgprint(wn._("You may need to update: ") + + wn.meta.get_docfield(cur_frm.doc.doctype, "description_html").label); + } } \ No newline at end of file