[FIX] web: FieldOne2ManyBinaryMultiFiles fix the loading for default ids files list

bzr revid: chm@openerp.com-20121115092149-lsbxb9ougxwkkktn
This commit is contained in:
Christophe Matthieu 2012-11-15 10:21:49 +01:00
parent 9460e71cbe
commit 739775253f
1 changed files with 14 additions and 1 deletions

View File

@ -5017,6 +5017,19 @@ instance.web.form.FieldOne2ManyBinaryMultiFiles = instance.web.form.AbstractFiel
this._super(this);
this.$el.on('change', 'input.oe_form_binary_file', this.on_file_change );
},
set_value: function(value_) {
var self = this;
if (value_ && typeof value_[0] != 'object') {
this.ds_file.call('read', [value_, ['name', 'datas_fname']]).done(function(data) {
_.each(data, function (val) {
val.no_unlink = true;
});
self.set_value(data);
});
} else {
this._super(value_);
}
},
get_value: function() {
return _.map(this.get('value'), function (value) { return commands.link_to( value.id ); });
},
@ -5111,7 +5124,7 @@ instance.web.form.FieldOne2ManyBinaryMultiFiles = instance.web.form.AbstractFiel
if(file_id != this.get('value')[i].id){
files.push(this.get('value')[i]);
}
else {
else if(!this.get('value')[i].no_unlink) {
this.ds_file.unlink([file_id]);
}
}