From 66556f811a9849247a5408e2e91d0bc00199aede Mon Sep 17 00:00:00 2001 From: msh-openerp Date: Thu, 5 Apr 2012 16:56:19 +0530 Subject: [PATCH] [FIX]Fixed the issue of setting filename in other field when widget=image. bzr revid: msh@tinyerp.com-20120405112619-nlkufj2p0iv3bwbg --- addons/web/static/src/js/view_form.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 335a4e39d72..0eb8f694686 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3222,6 +3222,13 @@ openerp.web.form.FieldBinary = openerp.web.form.Field.extend({ error: openerp.webclient.crashmanager.on_rpc_error }); }, + set_filename: function(value) { + var filename = this.node.attrs.filename; + if (this.view.fields[filename]) { + this.view.fields[filename].set_value(value); + this.view.fields[filename].on_ui_change(); + } + }, on_clear: function() { if (this.value !== false) { this.value = false; @@ -3256,13 +3263,6 @@ openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({ this.$element.find('input').eq(0).val(show_value); this.set_filename(name); }, - set_filename: function(value) { - var filename = this.node.attrs.filename; - if (this.view.fields[filename]) { - this.view.fields[filename].set_value(value); - this.view.fields[filename].on_ui_change(); - } - }, on_clear: function() { this._super.apply(this, arguments); this.$element.find('input').eq(0).val(''); @@ -3298,10 +3298,12 @@ openerp.web.form.FieldBinaryImage = openerp.web.form.FieldBinary.extend({ this.value = file_base64; this.binary_value = true; this.$image.attr('src', 'data:' + (content_type || 'image/png') + ';base64,' + file_base64); + this.set_filename(name); }, on_clear: function() { this._super.apply(this, arguments); this.$image.attr('src', '/web/static/src/img/placeholder.png'); + this.set_filename(''); } });