[IMP] view_form: radio css readonly

bzr revid: chm@openerp.com-20130411093319-q25a0fbybsjzwvfe
This commit is contained in:
Christophe Matthieu 2013-04-11 11:33:19 +02:00
parent 1d12a480c3
commit 9319356537
4 changed files with 15 additions and 6 deletions

View File

@ -2315,7 +2315,11 @@
.openerp .oe_form_field_radio.oe_horizontal {
white-space: nowrap;
}
.openerp .oe_form_field_radio.oe_required .oe_radio_input {
.openerp .oe_form_field_radio:not(.oe_readonly) .oe_radio_read_only,
.openerp .oe_form_field_radio.oe_readonly .oe_radio_edit_only {
display: none;
}
.openerp .oe_form_field_radio.oe_form_required .oe_radio_input {
border: 1px solid transparent;
display: inline-block;
height: 12px;
@ -2324,7 +2328,7 @@
border-radius: 10px;
margin: 1px 0;
}
.openerp .oe_form_field_radio.oe_required.oe_form_invalid .oe_radio_input {
.openerp .oe_form_field_radio.oe_form_required.oe_form_invalid .oe_radio_input {
border-color: red;
}
.openerp .oe_form_field_radio.oe_horizontal label,

View File

@ -490,7 +490,13 @@ $sheet-padding: 16px
&.oe_vertical
label
margin-left: 4px
&.oe_required
&:not(.oe_readonly)
.oe_radio_read_only
display: none
&.oe_readonly
.oe_radio_read_only
display: none
&.oe_form_required
.oe_radio_input
border: 2px solid transparent
display: inline-block

View File

@ -2885,8 +2885,7 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w
return value instanceof Array ? value[0] : value;
},
render_value: function () {
this.$(".oe_radio_edit_only, .oe_radio_read_only").hide();
this.$(this.get('effective_readonly') ? ".oe_radio_read_only" : ".oe_radio_edit_only").show();
this.$el.toggleClass("oe_readonly", this.get('effective_readonly'));
this.$("input[checked]").attr("checked", false);
if (this.get_value()) {
this.$("input[value='" + this.get_value() + "']").attr("checked", true);

View File

@ -1112,7 +1112,7 @@
</span>
</t>
<t t-name="FieldRadio">
<span t-attf-class="oe_form_field oe_form_field_radio #{widget.horizontal ? 'oe_horizontal' : 'oe_vertical'} #{widget.field.required or widget.node.attrs.required ? 'oe_required' : ''}" t-att-style="widget.node.attrs.style">
<span t-attf-class="oe_form_field oe_form_field_radio #{widget.horizontal ? 'oe_horizontal' : 'oe_vertical'}" t-att-style="widget.node.attrs.style">
<span class="oe_radio_edit_only">
<t t-if="widget.horizontal">
<t t-set="width" t-value="Math.floor(100 / widget.selection.length)"/>