[MERGE] point_of_sale: fix regression due to session api change

lp bug: https://launchpad.net/bugs/1215323 fixed

bzr revid: fva@openerp.com-20130902163640-e5l70h7m8270flkf
This commit is contained in:
Frédéric van der Essen 2013-09-02 18:36:40 +02:00
commit 25333a628d
3 changed files with 14 additions and 11 deletions

View File

@ -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.connection = new instance.web.JsonRPC();
this.connection.setup(url);
this.connection = new instance.web.Session(undefined,url);
this.bypass_proxy = false;
this.notifications = {};
},
close: function(){
this.connection.destroy();
},
message : function(name,params){
var ret = new $.Deferred();
var callbacks = this.notifications[name] || [];

View File

@ -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
fetch: function(model, fields, domain, ctx){
return new instance.web.Model(model).query(fields).filter(domain).context(ctx).all()

View File

@ -990,7 +990,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.close_button = new module.HeaderButtonWidget(this,{
label: _t('Close'),
action: function(){ self.try_close(); },
action: function(){ self.close(); },
});
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() {
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(
_.bind(function(res) {
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));
},
destroy: function() {
this.pos.destroy();
instance.webclient.set_content_full_screen(false);
self.pos = undefined;
this._super();
}
});