diff options
| author | Christophe Matthieu <chm@openerp.com> | 2012-11-15 10:21:49 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2012-11-15 10:21:49 +0100 |
| commit | 739775253f2d0f9e4fc9bdfd197369a14d72223a (patch) | |
| tree | d3959a8ee6e2a008d36259f8f6e020ab768685a6 /addons/web/static | |
| parent | 9460e71cbe6f83ee6890c5b25661a6aad9ffa700 (diff) | |
[FIX] web: FieldOne2ManyBinaryMultiFiles fix the loading for default ids files list
bzr revid: chm@openerp.com-20121115092149-lsbxb9ougxwkkktn
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 867569e2ea5..1be42849a96 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -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]); } } |
