diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 41e24edb31a..d4cb08ef331 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2797,18 +2797,28 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w init: function(field_manager, node) { var self = this; this._super(field_manager, node); - this.node = node; + this.horizontal = !!node.attrs.horizontal; + this.noradiolabel = !!node.attrs.noradiolabel; }, initialize_content: function() { var self = this; this.$table = $(''); this.$el.append(this.$table); - if (this.node.horizontal) { - var $tr = $(''); - _.each(this.field.selection, function (value) { - self.$tr.append(""); - }); - this.$table.append($tr); + if (this.horizontal) { + var width = Math.floor(100 / self.field.selection.length); + if (!this.noradiolabel) { + var $tr = $(''); + _.each(this.field.selection, function (value) { + $tr.append('"); + }); + this.$table.append($tr); + } else { + var $column = $(''); + _.each(this.field.selection, function (value) { + $column.append(''); + }); + this.$table.append($column); + } } this.$el.on('click', '.oe_radio_button,.oe_radio_label', function (event) { if (!self.get("effective_readonly")) { @@ -2826,17 +2836,17 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w }, render_value: function () { var self = this; - if (this.node.horizontal) { - this.$table.find("tr:eq(2,)").remove(); + if (this.horizontal) { + this.$table.find(!this.noradiolabel ? "tr:not(:first)": "tr").remove(); var $tr = $(''); _.each(this.field.selection, function (value) { - self.$tr.append(''); + $tr.append(''); }); this.$table.append($tr); } else { this.$table.find("tr").remove(); _.each(this.field.selection, function (value) { - self.$table.append(''); + self.$table.append('' + (!self.noradiolabel ? '' : '') +''); }); } }
" + value[1] + "
' + value[1] + "
' + self.render_value_input(value) + '' + self.render_value_input(value) + '
' + self.render_value_input(value) + '' + value[1] + '
' + self.render_value_input(value) + '' + value[1] + '