From fdd78a5dcfb182d18d34da3ce82c712eda820a54 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Tue, 5 Jun 2012 18:16:10 +0200 Subject: [PATCH] [fix] small problem with visibility and reinitialize mixin bzr revid: nicolas.vanhoren@openerp.com-20120605161610-vaokz5p7pz706lqj --- addons/web/static/src/js/view_form.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e5b60c49a46..43094a97e66 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1382,15 +1382,15 @@ instance.web.form.InvisibilityChangerMixin = { _.bind(check, this)(); }, start: function() { - var check_visibility = function() { - if (this.get("effective_invisible")) { - this.$element.hide(); - } else { - this.$element.show(); - } - }; - this.on("change:effective_invisible", this, check_visibility); - _.bind(check_visibility, this)(); + this.on("change:effective_invisible", this, this._check_visibility); + this._check_visibility(); + }, + _check_visibility: function() { + if (this.get("effective_invisible")) { + this.$element.hide(); + } else { + this.$element.show(); + } }, }; @@ -1737,6 +1737,8 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(_.extend({ this.on("change:required", this, this._set_required); this._set_required(); } + this._check_visibility(); + this._check_css_flags(); }, /** * Private. Do not use.