|
@ -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') |