diff options
| author | Aaron Bohy <aab@odoo.com> | 2015-07-07 10:34:18 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2015-07-07 16:43:01 +0200 |
| commit | 81ffa759442f10387a306aa85367a237e07c7fb3 (patch) | |
| tree | e4829fcfed2077b6b32100c9bc86f25195996504 /addons/web | |
| parent | 08faf63a6dd436804875164ab3c9141a1edcfdda (diff) | |
[FIX] web: many2manytags: hidden if empty and readonly
In edit mode, if this field is readonly and empty, its main div has
height 0 but its border is displayed. This rev. simply hides the field
in this case.
Diffstat (limited to 'addons/web')
| -rw-r--r-- | addons/web/static/src/js/views/form_common.js | 12 | ||||
| -rw-r--r-- | addons/web/static/src/less/enterprise_compatibility.less | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/form_common.js b/addons/web/static/src/js/views/form_common.js index cd6d061919f..19737746b4a 100644 --- a/addons/web/static/src/js/views/form_common.js +++ b/addons/web/static/src/js/views/form_common.js @@ -692,10 +692,20 @@ var AbstractField = FormWidget.extend(FieldInterface, { start: function() { this._super(); this.on("change:value", this, function() { - if (! this.no_rerender) + if (!this.no_rerender) { this.render_value(); + } + this._toggle_label(); + }); + this.on("change:effective_readonly", this, function() { + this._toggle_label(); }); this.render_value(); + this._toggle_label(); + }, + _toggle_label: function() { + var empty = this.get('effective_readonly') && this.is_false(); + this.$el.toggleClass('o_form_field_empty', empty); }, /** * Private. Do not use. diff --git a/addons/web/static/src/less/enterprise_compatibility.less b/addons/web/static/src/less/enterprise_compatibility.less index bab17780958..8d97c3b74d3 100644 --- a/addons/web/static/src/less/enterprise_compatibility.less +++ b/addons/web/static/src/less/enterprise_compatibility.less @@ -247,6 +247,10 @@ border: 1px solid #CCC; border-radius: 3px; + &.o_form_field_empty { + display: none; + } + > .oe_form_field { .o-flex(1, 0, 100px); |
