Ported m2mtags, reference and binary, still need to port o2m & m2m

bzr revid: nicolas.vanhoren@openerp.com-20121011154700-nm1j0nibq3xazaix
This commit is contained in:
niv-openerp 2012-10-11 17:47:00 +02:00
parent 2fadf797e5
commit b164a96535
1 changed files with 5 additions and 18 deletions

View File

@ -3830,7 +3830,6 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
start: function() { start: function() {
this._super(); this._super();
instance.web.form.ReinitializeFieldMixin.start.call(this); instance.web.form.ReinitializeFieldMixin.start.call(this);
this.on("change:value", this, this.render_value);
}, },
initialize_content: function() { initialize_content: function() {
if (this.get("effective_readonly")) if (this.get("effective_readonly"))
@ -4624,10 +4623,6 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan
is_false: function() { is_false: function() {
return typeof(this.get_value()) !== 'string'; return typeof(this.get_value()) !== 'string';
}, },
set_value: function(value_) {
this._super(value_);
this.render_value();
},
render_value: function() { render_value: function() {
this.reference_ready = false; this.reference_ready = false;
var vals = [], sel_val, m2o_val; var vals = [], sel_val, m2o_val;
@ -4647,9 +4642,9 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan
var model = this.selection.get_value(), var model = this.selection.get_value(),
id = this.m2o.get_value(); id = this.m2o.get_value();
if (typeof(model) === 'string' && typeof(id) === 'number') { if (typeof(model) === 'string' && typeof(id) === 'number') {
this.set({'value': model + ',' + id}); this.internal_set_value(model + ',' + id);
} else { } else {
this.set({'value': false}); this.internal_set_value(false);
} }
}, },
}); });
@ -4748,7 +4743,7 @@ instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance.
on_clear: function() { on_clear: function() {
if (this.get('value') !== false) { if (this.get('value') !== false) {
this.binary_value = false; this.binary_value = false;
this.set({'value': false}); this.internal_set_value(false);
} }
return false; return false;
} }
@ -4768,10 +4763,6 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({
}); });
} }
}, },
set_value: function(value_) {
this._super.apply(this, arguments);
this.render_value();
},
render_value: function() { render_value: function() {
if (!this.get("effective_readonly")) { if (!this.get("effective_readonly")) {
var show_value; var show_value;
@ -4793,7 +4784,7 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({
}, },
on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { on_file_uploaded_and_valid: function(size, name, content_type, file_base64) {
this.binary_value = true; this.binary_value = true;
this.set({'value': file_base64}); this.internal_set_value(file_base64);
var show_value = name + " (" + this.human_filesize(size) + ")"; var show_value = name + " (" + this.human_filesize(size) + ")";
this.$el.find('input').eq(0).val(show_value); this.$el.find('input').eq(0).val(show_value);
this.set_filename(name); this.set_filename(name);
@ -4807,10 +4798,6 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({
instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
template: 'FieldBinaryImage', template: 'FieldBinaryImage',
set_value: function(value_) {
this._super.apply(this, arguments);
this.render_value();
},
render_value: function() { render_value: function() {
var self = this; var self = this;
var url; var url;
@ -4843,7 +4830,7 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
this._super.apply(this, arguments); this._super.apply(this, arguments);
}, },
on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { on_file_uploaded_and_valid: function(size, name, content_type, file_base64) {
this.set({'value': file_base64}); this.internal_set_value(file_base64);
this.binary_value = true; this.binary_value = true;
this.render_value(); this.render_value();
this.set_filename(name); this.set_filename(name);