diff options
| author | Frederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com> | 2014-09-08 17:49:10 +0200 |
|---|---|---|
| committer | Frederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com> | 2014-09-08 18:06:51 +0200 |
| commit | 89e179971a5e7945919769cf7f30fbdacc53afca (patch) | |
| tree | 4ce6efa0f90dfc5e222d1a68c417ca74e140725b | |
| parent | a11b530b9b03dcd94c710d68d6949f7d78d70756 (diff) | |
[FIX] point_of_sale: flush orders before closing the pos. This will help prevent users from closing the session with unflushed orders
| -rw-r--r-- | addons/point_of_sale/static/src/js/widgets.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index f7d2d1c8086..41900fffa66 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -1231,8 +1231,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa var self = this; function close(){ - return new instance.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_client_pos_menu']], ['res_id']).pipe(function(res) { - window.location = '/web#action=' + res[0]['res_id']; + self.pos.push_order().then(function(){ + return new instance.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_client_pos_menu']], ['res_id']).pipe(function(res) { + window.location = '/web#action=' + res[0]['res_id']; + }); }); } @@ -1241,10 +1243,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa }); if(draft_order){ if (confirm(_t("Pending orders will be lost.\nAre you sure you want to leave this session?"))) { - return close(); + close(); } }else{ - return close(); + close(); } }, destroy: function() { |
