[imp] changed is_stopped

bzr revid: nicolas.vanhoren@openerp.com-20120221155516-7eczor9bobky9dxq
This commit is contained in:
niv-openerp
2012-02-21 16:55:16 +01:00
parent be66f62357
commit 7fcfcbaddb
+6 -5
View File
@@ -1022,8 +1022,6 @@ openerp.web.Widget = openerp.web.CallbackEnabled.extend(/** @lends openerp.web.W
parent.__parented_children = [];
parent.getChildren().push(this);
}
// useful to know if the widget was destroyed and should not be used anymore
this.widget_is_stopped = false;
},
getParent: function() {
return this.__parented_parent;
@@ -1031,6 +1029,9 @@ openerp.web.Widget = openerp.web.CallbackEnabled.extend(/** @lends openerp.web.W
getChildren: function() {
return this.__parented_children || [];
},
isStopped: function() {
return this.__parented_stopped;
},
/**
* Renders the current widget and appends it to the given jQuery object or Widget.
*
@@ -1132,7 +1133,7 @@ openerp.web.Widget = openerp.web.CallbackEnabled.extend(/** @lends openerp.web.W
this.$element.remove();
}
this.setParent(undefined);
this.widget_is_stopped = true;
this.__parented_stopped = true;
},
/**
* Informs the action manager to do an action. This supposes that
@@ -1162,10 +1163,10 @@ openerp.web.Widget = openerp.web.CallbackEnabled.extend(/** @lends openerp.web.W
var def = $.Deferred().then(success, error);
var self = this;
openerp.connection.rpc(url, data). then(function() {
if (!self.widget_is_stopped)
if (!self.isStopped())
def.resolve.apply(def, arguments);
}, function() {
if (!self.widget_is_stopped)
if (!self.isStopped())
def.reject.apply(def, arguments);
});
return def.promise();