mirror of https://github.com/OCA/web.git
[FIX] polymorphic widget is set to readonly if linked model value is none
parent
a246acc15a
commit
d5e4988657
|
@ -41,6 +41,23 @@ openerp.web_polymorphic = function (instance) {
|
||||||
self.field.relation = self.field_manager.get_field_value(self.polymorphic);
|
self.field.relation = self.field_manager.get_field_value(self.polymorphic);
|
||||||
});
|
});
|
||||||
this._super();
|
this._super();
|
||||||
|
this.set_polymorphic_event();
|
||||||
|
this.set({
|
||||||
|
readonly: true
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
set_polymorphic_event: function() {
|
||||||
|
self = this;
|
||||||
|
this.field_manager.fields[this.polymorphic].$el.on(
|
||||||
|
'change', function(){
|
||||||
|
field_value = self.field_manager.get_field_value(self.polymorphic);
|
||||||
|
if(field_value !== false)
|
||||||
|
self.set("effective_readonly", false);
|
||||||
|
else
|
||||||
|
self.set("effective_readonly", true);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
instance.web.form.widgets.add('polymorphic', 'instance.web.form.FieldPolymorphic')
|
instance.web.form.widgets.add('polymorphic', 'instance.web.form.FieldPolymorphic')
|
Loading…
Reference in New Issue