[FIX] point_of_sale: fix regression due to session api change. + some cleanup on ressource release on quit.
bzr revid: fva@openerp.com-20130902155907-99qk1bnmj1o4ztpe
This commit is contained in:
parent
00d3d9a4b6
commit
a9f5a82986
|
@ -25,13 +25,15 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal
|
||||||
};
|
};
|
||||||
this.custom_payment_status = this.default_payment_status;
|
this.custom_payment_status = this.default_payment_status;
|
||||||
|
|
||||||
this.connection = new instance.web.JsonRPC();
|
this.connection = new instance.web.Session(undefined,url);
|
||||||
this.connection.setup(url);
|
|
||||||
|
|
||||||
this.bypass_proxy = false;
|
this.bypass_proxy = false;
|
||||||
this.notifications = {};
|
this.notifications = {};
|
||||||
|
|
||||||
},
|
},
|
||||||
|
close: function(){
|
||||||
|
this.connection.destroy();
|
||||||
|
},
|
||||||
message : function(name,params){
|
message : function(name,params){
|
||||||
var ret = new $.Deferred();
|
var ret = new $.Deferred();
|
||||||
var callbacks = this.notifications[name] || [];
|
var callbacks = this.notifications[name] || [];
|
||||||
|
|
|
@ -71,6 +71,14 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// releases ressources holds by the model at the end of life of the posmodel
|
||||||
|
destroy: function(){
|
||||||
|
// FIXME, should wait for flushing, return a deferred to indicate successfull destruction
|
||||||
|
// this.flush();
|
||||||
|
this.proxy.close();
|
||||||
|
this.barcode_reader.disconnect();
|
||||||
|
},
|
||||||
|
|
||||||
// helper function to load data from the server
|
// helper function to load data from the server
|
||||||
fetch: function(model, fields, domain, ctx){
|
fetch: function(model, fields, domain, ctx){
|
||||||
return new instance.web.Model(model).query(fields).filter(domain).context(ctx).all()
|
return new instance.web.Model(model).query(fields).filter(domain).context(ctx).all()
|
||||||
|
|
|
@ -990,7 +990,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
|
||||||
|
|
||||||
this.close_button = new module.HeaderButtonWidget(this,{
|
this.close_button = new module.HeaderButtonWidget(this,{
|
||||||
label: _t('Close'),
|
label: _t('Close'),
|
||||||
action: function(){ self.try_close(); },
|
action: function(){ self.close(); },
|
||||||
});
|
});
|
||||||
this.close_button.appendTo(this.$('#rightheader'));
|
this.close_button.appendTo(this.$('#rightheader'));
|
||||||
|
|
||||||
|
@ -1100,15 +1100,8 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
try_close: function() {
|
|
||||||
var self = this;
|
|
||||||
//TODO : do the close after the flush...
|
|
||||||
self.pos.flush()
|
|
||||||
self.close();
|
|
||||||
},
|
|
||||||
close: function() {
|
close: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.pos.barcode_reader.disconnect();
|
|
||||||
return new instance.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_client_pos_menu']], ['res_id']).pipe(
|
return new instance.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_client_pos_menu']], ['res_id']).pipe(
|
||||||
_.bind(function(res) {
|
_.bind(function(res) {
|
||||||
return this.rpc('/web/action/load', {'action_id': res[0]['res_id']}).pipe(_.bind(function(result) {
|
return this.rpc('/web/action/load', {'action_id': res[0]['res_id']}).pipe(_.bind(function(result) {
|
||||||
|
@ -1120,8 +1113,8 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
|
||||||
}, this));
|
}, this));
|
||||||
},
|
},
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
|
this.pos.destroy();
|
||||||
instance.webclient.set_content_full_screen(false);
|
instance.webclient.set_content_full_screen(false);
|
||||||
self.pos = undefined;
|
|
||||||
this._super();
|
this._super();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue