Browse Source

[FIX] polymorphic widget is set to readonly if linked model value is none

pull/4/head
Augustin Cisterne-Kaas 11 years ago
parent
commit
d5e4988657
  1. 0
      web_many2one_polymorphic/__init__.py
  2. 0
      web_many2one_polymorphic/__openerp__.py
  3. 17
      web_many2one_polymorphic/static/src/js/view_form.js

0
web_polymorphic/__init__.py → web_many2one_polymorphic/__init__.py

0
web_polymorphic/__openerp__.py → web_many2one_polymorphic/__openerp__.py

17
web_polymorphic/static/src/js/view_form.js → web_many2one_polymorphic/static/src/js/view_form.js

@ -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…
Cancel
Save