From 72dbae9ddf70a71a3079df1dc9a273c448d51655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 27 Mar 2013 13:55:41 +0100 Subject: [PATCH] [FIX] point_of_sale: prevent from spinner to appear when we have a rpc timeout, and try to flush saved orders after loading bzr revid: fva@openerp.com-20130327125541-pbqkn764h6fngf33 --- addons/point_of_sale/static/src/js/models.js | 3 ++- addons/point_of_sale/static/src/js/widgets.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index d2cf15b54f3..660434ba53e 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -295,7 +295,8 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal return; } //try to push an order to the server - (new instance.web.Model('pos.order')).get_func('create_from_ui')([order]) + // shadow : true is to prevent a spinner to appear in case of timeout + (new instance.web.Model('pos.order')).call('create_from_ui',[[order]],undefined,{ shadow:true }) .fail(function(unused, event){ //don't show error popup if it fails event.preventDefault(); diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index cfc0dfc9b24..cec48dbe72f 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -879,6 +879,8 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa instance.web.unblockUI(); self.$('.loader').animate({opacity:0},1500,'swing',function(){self.$('.loader').hide();}); + self.pos.flush(); + }).fail(function(){ // error when loading models data from the backend instance.web.unblockUI(); return new instance.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_pos_session_opening']], ['res_id'])