From 780732acd32a676f8a339f68838d1f86d0715d39 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 19 Jan 2016 16:17:28 +0530 Subject: [PATCH] Fixed issue with Image display for Attach Image field type while document status is submitted --- frappe/public/js/frappe/form/control.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frappe/public/js/frappe/form/control.js b/frappe/public/js/frappe/form/control.js index f29d6d762e..7c6e627f9d 100644 --- a/frappe/public/js/frappe/form/control.js +++ b/frappe/public/js/frappe/form/control.js @@ -885,12 +885,12 @@ frappe.ui.form.ControlAttach = frappe.ui.form.ControlData.extend({ }); frappe.ui.form.ControlAttachImage = frappe.ui.form.ControlAttach.extend({ - make_input: function() { + make: function() { var me = this; this._super(); this.img_wrapper = $('
\
') - .prependTo(this.input_area); + .appendTo(this.wrapper); this.img = $("") .appendTo(this.img_wrapper).toggle(false); @@ -900,16 +900,18 @@ frappe.ui.form.ControlAttachImage = frappe.ui.form.ControlAttach.extend({ this.$wrapper.on("refresh", function() { me.set_image(); + if(me.get_status()=="Read") { + $(me.disp_area).toggle(false); + } }); - this.set_image(); }, set_image: function() { if(this.get_value()) { - $(this.input_area).find(".missing-image").toggle(false); + $(this.img_wrapper).find(".missing-image").toggle(false); this.img.attr("src", this.dataurl ? this.dataurl : this.value).toggle(true); } else { - $(this.input_area).find(".missing-image").toggle(true); + $(this.img_wrapper).find(".missing-image").toggle(true); this.img.toggle(false); } }