[FIX] web: FieldMany2ManyBinaryMultiFiles must extend ReinitializeFieldMixin

The add attachment button should be displayed while being in edit mode, but not in view mode
As the widget depends on the form actual mode, the widget should be re-rendered each time the actual mode changes

This is the point of the ReinitializeFieldMixin class
This commit is contained in:
Denis Ledoux 2014-11-06 14:49:25 +01:00
parent 150dc66ec0
commit d36c8b5c9b
1 changed files with 3 additions and 2 deletions

View File

@ -5222,7 +5222,7 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
* Options on attribute ; "blockui" {Boolean} block the UI or not
* during the file is uploading
*/
instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractField.extend({
instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, {
template: "FieldBinaryFileUploader",
init: function(field_manager, node) {
this._super(field_manager, node);
@ -5236,7 +5236,8 @@ instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractFie
$(window).on(this.fileupload_id, _.bind(this.on_file_loaded, this));
},
start: function() {
this._super(this);
this._super();
instance.web.form.ReinitializeFieldMixin.start.call(this);
this.$el.on('change', 'input.oe_form_binary_file', this.on_file_change );
},
set_value: function(value_) {