[FIX] point_of_sale: prevent empty order creation as they are not accepted by the...
authorFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Tue, 7 Oct 2014 16:18:59 +0000 (18:18 +0200)
committerFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Tue, 7 Oct 2014 16:18:59 +0000 (18:18 +0200)
addons/point_of_sale/static/src/js/screens.js

index 2ce5adf..63caa5f 100644 (file)
@@ -1245,6 +1245,14 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
 
             var currentOrder = this.pos.get('selectedOrder');
 
+            if(currentOrder.get('orderLines').models.length === 0){
+                this.pos_widget.screen_selector.show_popup('error',{
+                    'message': _t('Empty Order'),
+                    'comment': _t('There must be at least one product in your order before it can be validated'),
+                });
+                return;
+            }
+
             if(!this.is_paid()){
                 return;
             }