summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2015-01-02 17:15:08 +0100
committerThibault Delavallée <tde@openerp.com>2015-01-30 14:36:28 +0100
commitf05e5922fbf4fcbbee3e7d9e2f198b5c3c005ce2 (patch)
tree76685bc05553d5365e1194525e08c05c3a8050b5 /addons
parent34d99d9ba80c0d8cbce041d8f8b22cd096c3d638 (diff)
[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.
Diffstat (limited to 'addons')
-rw-r--r--addons/web/static/src/js/view_form.js19
1 files changed, 8 insertions, 11 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 4f8fc48094c..c06c50ceea4 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -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] : "");
}
});