mirror of https://github.com/OCA/web.git
[IMP] upgrade from 6.1 to 7.0
parent
26aa7088d8
commit
2ea5f5dff4
|
@ -7,20 +7,26 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
openerp.web_confirm_window_close = function(openerp) {
|
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({
|
openerp.web.FormView.include({
|
||||||
|
|
||||||
warning_on_close: function() {
|
warning_on_close: function() {
|
||||||
if (this.widget_parent && this.widget_parent.active_view == 'form' && this.$element.hasClass('oe_form_dirty')) {
|
if (this.ViewManager
|
||||||
// Firefox will show a generic confirmation dialog
|
&& this.ViewManager.active_view == 'form'
|
||||||
// When any text is returned here.
|
&& this.$el.hasClass('oe_form_dirty'))
|
||||||
return openerp.web._t('You have unsaved data in this window. Do you really want to leave?');
|
// 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() {
|
start: function() {
|
||||||
res = this._super();
|
res = this._super();
|
||||||
if (!(this.embedded_view)) {
|
if (!(this.embedded_view)) {
|
||||||
$(window).bind('beforeunload', _.bind(
|
$(window).on("beforeunload", _.bind(
|
||||||
this.warning_on_close, this));
|
this.warning_on_close, this));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Reference in New Issue