From 253cfdd59d32f3329684ec69b05a7423784d78a4 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 2 May 2012 13:42:15 +0200 Subject: [PATCH] [fix] problem with required attrs bzr revid: nicolas.vanhoren@openerp.com-20120502114215-ezdqmbpe2j2yafdv --- addons/web/static/src/js/view_form.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 18e8d1ff9ac..09dd69074d8 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1417,10 +1417,6 @@ instance.web.form.FormWidget = instance.web.Widget.extend(_.extend({}, instance. this._super(); this.$element.addClass(this.node.attrs["class"] || ""); }, - start: function() { - this._super(); - instance.web.form.InvisibilityChangerMixin.start.call(this); - }, destroy: function() { $.fn.tipsy.clear(); this._super.apply(this, arguments); @@ -1710,8 +1706,8 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(_.extend({ this._check_css_flags(); }); }, - start: function() { - this._super.apply(this, arguments); + renderElement: function() { + this._super(); if (this.field.translate) { this.$element.addClass('oe_form_field_translatable'); this.$element.find('.oe_field_translate').click(_.bind(function() { @@ -1722,13 +1718,17 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(_.extend({ this.do_attach_tooltip(this, this.view.$element.find('label[for=' + this.id_for_label + ']')[0] || this.$element); } if (!this.disable_utility_classes) { - var set_required = function() { - this.$element.toggleClass('oe_form_required', this.get("required")); - }; - this.on("change:required", this, set_required); - _.bind(set_required, this)(); + this.off("change:required", this, this._set_required); + this.on("change:required", this, this._set_required); + this._set_required(); } }, + /** + * Private. Do not use. + */ + _set_required: function() { + this.$element.toggleClass('oe_form_required', this.get("required")); + }, set_value: function(value_) { this._inhibit_on_change = true; this.set({'value': value_});