[FIX][IMP] web: radio button: small fix / imp, removing an unnecessary

check on the value in the code. Indeed this could prevent from putting the radio
button on a selection field holding a 0 integer as selection value.
This commit is contained in:
qsm-odoo
2015-01-30 14:36:28 +01:00
committed by Thibault Delavallée
parent 34d99d9ba8
commit f05e5922fb
+8 -11
View File
@@ -3268,14 +3268,13 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w
});
},
set_value: function (value_) {
if (value_) {
if (this.field.type == "selection") {
value_ = _.find(this.field.selection, function (sel) { return sel[0] == value_;});
}
else if (!this.selection.length) {
this.selection = [value_];
}
if (this.field.type == "selection") {
value_ = _.find(this.field.selection, function (sel) { return sel[0] == value_;});
}
else if (!this.selection.length) {
this.selection = [value_];
}
this._super(value_);
},
get_value: function () {
@@ -3285,10 +3284,8 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w
render_value: function () {
var self = this;
this.$el.toggleClass("oe_readonly", this.get('effective_readonly'));
if (this.get_value()) {
this.$("input").filter(function () {return this.value == self.get_value();}).prop("checked", true);
this.$(".oe_radio_readonly").text(this.get('value') ? this.get('value')[1] : "");
}
this.$("input").filter(function () {return this.value == self.get_value();}).prop("checked", true);
this.$(".oe_radio_readonly").text(this.get('value') ? this.get('value')[1] : "");
}
});