From 2ea5f5dff40c9447ab78336fabf2454ef8b98e45 Mon Sep 17 00:00:00 2001 From: Hans van Dijk Date: Thu, 22 Aug 2013 17:01:57 +0200 Subject: [PATCH] [IMP] upgrade from 6.1 to 7.0 --- .../static/src/js/web_confirm_window_close.js | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/web_confirm_window_close/static/src/js/web_confirm_window_close.js b/web_confirm_window_close/static/src/js/web_confirm_window_close.js index d07dc6a1..753addba 100644 --- a/web_confirm_window_close/static/src/js/web_confirm_window_close.js +++ b/web_confirm_window_close/static/src/js/web_confirm_window_close.js @@ -7,20 +7,26 @@ */ openerp.web_confirm_window_close = function(openerp) { + //3 essential differences between 6.1 and 7.0 + // - widget_parent replaced by ViewManager + // - $element. replaced by $el + // - $(window).bind replaced by $(window).on openerp.web.FormView.include({ - warning_on_close: function() { - if (this.widget_parent && this.widget_parent.active_view == 'form' && this.$element.hasClass('oe_form_dirty')) { - // Firefox will show a generic confirmation dialog - // When any text is returned here. - return openerp.web._t('You have unsaved data in this window. Do you really want to leave?'); - } + if (this.ViewManager + && this.ViewManager.active_view == 'form' + && this.$el.hasClass('oe_form_dirty')) + // Firefox will show a generic confirmation dialog + // When any text is returned here. + return openerp.web._t( + "You have unsaved data in this window. " + + "Do you really want to leave?"); }, - + start: function() { res = this._super(); if (!(this.embedded_view)) { - $(window).bind('beforeunload', _.bind( + $(window).on("beforeunload", _.bind( this.warning_on_close, this)); } return res;