[IMP] web: allow fields in list view to use the attrs readonly to dynamically show and hide the fields
This commit is contained in:
parent
e5533d0c14
commit
bccd75796e
|
@ -2815,11 +2815,11 @@
|
||||||
.openerp .oe_list_editable .oe_list_content td.oe_list_field_cell {
|
.openerp .oe_list_editable .oe_list_content td.oe_list_field_cell {
|
||||||
padding: 4px 6px 3px;
|
padding: 4px 6px 3px;
|
||||||
}
|
}
|
||||||
.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) {
|
.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell {
|
||||||
color: transparent;
|
color: transparent;
|
||||||
text-shadow: none;
|
text-shadow: none;
|
||||||
}
|
}
|
||||||
.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * {
|
.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell * {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
.openerp .oe_list.oe_list_editable.oe_editing .oe_m2o_drop_down_button {
|
.openerp .oe_list.oe_list_editable.oe_editing .oe_m2o_drop_down_button {
|
||||||
|
@ -2835,6 +2835,13 @@
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
max-width: none;
|
max-width: none;
|
||||||
}
|
}
|
||||||
|
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_list_field_handle {
|
||||||
|
color: transparent;
|
||||||
|
}
|
||||||
|
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_readonly {
|
||||||
|
padding: 4px 6px 3px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea {
|
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea {
|
||||||
height: 27px;
|
height: 27px;
|
||||||
-moz-border-radius: 0;
|
-moz-border-radius: 0;
|
||||||
|
@ -2846,9 +2853,14 @@
|
||||||
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field select {
|
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field select {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer input {
|
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float.oe_readonly, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer.oe_readonly {
|
||||||
|
padding: 6px 0px 0px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
max-width: 100px;
|
||||||
|
}
|
||||||
|
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer input {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime input.oe_datepicker_master, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date input.oe_datepicker_master {
|
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime input.oe_datepicker_master, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date input.oe_datepicker_master {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
|
|
|
@ -2218,7 +2218,7 @@ $sheet-padding: 16px
|
||||||
.oe_list_editable .oe_list_content td.oe_list_field_cell
|
.oe_list_editable .oe_list_content td.oe_list_field_cell
|
||||||
padding: 4px 6px 3px
|
padding: 4px 6px 3px
|
||||||
.oe_list.oe_list_editable.oe_editing
|
.oe_list.oe_list_editable.oe_editing
|
||||||
.oe_edition .oe_list_field_cell:not(.oe_readonly)
|
.oe_edition .oe_list_field_cell
|
||||||
*
|
*
|
||||||
visibility: hidden
|
visibility: hidden
|
||||||
color: transparent
|
color: transparent
|
||||||
|
@ -2230,6 +2230,11 @@ $sheet-padding: 16px
|
||||||
.oe_input_icon
|
.oe_input_icon
|
||||||
margin-top: 5px
|
margin-top: 5px
|
||||||
.oe_form_field
|
.oe_form_field
|
||||||
|
&.oe_list_field_handle
|
||||||
|
color: transparent
|
||||||
|
&.oe_readonly
|
||||||
|
padding: 4px 6px 3px
|
||||||
|
text-align: left
|
||||||
min-width: 0
|
min-width: 0
|
||||||
max-width: none
|
max-width: none
|
||||||
input, textarea
|
input, textarea
|
||||||
|
@ -2240,9 +2245,13 @@ $sheet-padding: 16px
|
||||||
input, textarea, select
|
input, textarea, select
|
||||||
min-width: 0
|
min-width: 0
|
||||||
&.oe_form_field_float,&.oe_form_view_integer
|
&.oe_form_field_float,&.oe_form_view_integer
|
||||||
input
|
&.oe_readonly
|
||||||
|
padding: 6px 0px 0px
|
||||||
text-align: right
|
text-align: right
|
||||||
|
max-width: 100px
|
||||||
|
input
|
||||||
width: 100% !important
|
width: 100% !important
|
||||||
|
text-align: right
|
||||||
&.oe_form_field_datetime,&.oe_form_field_date
|
&.oe_form_field_datetime,&.oe_form_field_date
|
||||||
input.oe_datepicker_master
|
input.oe_datepicker_master
|
||||||
width: 100% !important
|
width: 100% !important
|
||||||
|
|
|
@ -2600,7 +2600,9 @@ instance.web.form.FieldDatetime = instance.web.form.AbstractField.extend(instanc
|
||||||
},
|
},
|
||||||
set_dimensions: function (height, width) {
|
set_dimensions: function (height, width) {
|
||||||
this._super(height, width);
|
this._super(height, width);
|
||||||
this.datewidget.$input.css('height', height);
|
if (!this.get("effective_readonly")) {
|
||||||
|
this.datewidget.$input.css('height', height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3395,7 +3397,8 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
||||||
},
|
},
|
||||||
set_dimensions: function (height, width) {
|
set_dimensions: function (height, width) {
|
||||||
this._super(height, width);
|
this._super(height, width);
|
||||||
this.$input.css('height', height);
|
if (!this.get("effective_readonly") && this.$input)
|
||||||
|
this.$input.css('height', height);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -282,9 +282,7 @@ openerp.web.list_editable = function (instance) {
|
||||||
if (!this.editor.is_editing()) { return; }
|
if (!this.editor.is_editing()) { return; }
|
||||||
for(var i=0, len=this.fields_for_resize.length; i<len; ++i) {
|
for(var i=0, len=this.fields_for_resize.length; i<len; ++i) {
|
||||||
var item = this.fields_for_resize[i];
|
var item = this.fields_for_resize[i];
|
||||||
if (!item.field.get('effective_invisible')) {
|
this.resize_field(item.field, item.cell);
|
||||||
this.resize_field(item.field, item.cell);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -303,6 +301,11 @@ openerp.web.list_editable = function (instance) {
|
||||||
at: 'left top',
|
at: 'left top',
|
||||||
of: $cell
|
of: $cell
|
||||||
});
|
});
|
||||||
|
if (field.get('effective_readonly')) {
|
||||||
|
field.$el.addClass('oe_readonly');
|
||||||
|
}
|
||||||
|
if(field.widget == "handle")
|
||||||
|
field.$el.addClass('oe_list_field_handle');
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @return {jQuery.Deferred}
|
* @return {jQuery.Deferred}
|
||||||
|
@ -448,13 +451,7 @@ openerp.web.list_editable = function (instance) {
|
||||||
setup_events: function () {
|
setup_events: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
_.each(this.editor.form.fields, function(field, field_name) {
|
_.each(this.editor.form.fields, function(field, field_name) {
|
||||||
var set_invisible = function() {
|
field.on("change:effective_readonly", self, function(){
|
||||||
field.set({'force_invisible': field.get('effective_readonly')});
|
|
||||||
};
|
|
||||||
field.on("change:effective_readonly", self, set_invisible);
|
|
||||||
set_invisible();
|
|
||||||
field.on('change:effective_invisible', self, function () {
|
|
||||||
if (field.get('effective_invisible')) { return; }
|
|
||||||
var item = _(self.fields_for_resize).find(function (item) {
|
var item = _(self.fields_for_resize).find(function (item) {
|
||||||
return item.field === field;
|
return item.field === field;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue