[FIX]Fixed the issue of setting filename in other field when widget=image.
bzr revid: msh@tinyerp.com-20120405112619-nlkufj2p0iv3bwbg
This commit is contained in:
parent
ccafcb6d90
commit
66556f811a
|
@ -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('');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue