[IMP] point_of_sale: add debug popup that displays unsent order data, for when localS...
authorFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Tue, 22 Jul 2014 13:27:34 +0000 (15:27 +0200)
committerFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Tue, 5 Aug 2014 12:07:14 +0000 (14:07 +0200)
Conflicts:
addons/point_of_sale/static/src/js/widgets.js

addons/point_of_sale/static/src/css/pos.css
addons/point_of_sale/static/src/js/screens.js
addons/point_of_sale/static/src/js/widgets.js
addons/point_of_sale/static/src/xml/pos.xml

index 9836e5d..0c44d3d 100644 (file)
@@ -1671,6 +1671,9 @@ td {
     font-size: 14px;
     text-align: left;
     font-family: 'Inconsolata';
+    -webkit-user-select: text;
+       -moz-user-select: text;
+            user-select: text;
 }
 .pos .popup .footer{
     position:absolute;
index ca09719..0485077 100644 (file)
@@ -418,6 +418,18 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
         template: 'ErrorInvoiceTransferPopupWidget',
     });
 
+    module.UnsentOrdersPopupWidget = module.PopUpWidget.extend({
+        template: 'UnsentOrdersPopupWidget',
+        show: function(options){
+            var self = this;
+            this._super(options);
+            this.renderElement();
+            this.$('.button.confirm').click(function(){
+                self.pos_widget.screen_selector.close_popup();
+            });
+        },
+    });
+
     module.ScaleScreenWidget = module.ScreenWidget.extend({
         template:'ScaleScreenWidget',
 
index cc9a8fe..ddc0854 100644 (file)
@@ -797,6 +797,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
             this.$('.button.reference').click(function(){
                 self.pos.barcode_reader.scan(self.$('input.ean').val());
             });
+            this.$('.button.show_orders').click(function(){
+                self.pos.pos_widget.screen_selector.show_popup('unsent-orders');
+            });
             _.each(this.eans, function(ean, name){
                 self.$('.button.'+name).click(function(){
                     self.$('input.ean').val(ean);
@@ -1088,6 +1091,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
             this.confirm_popup = new module.ConfirmPopupWidget(this,{});
             this.confirm_popup.appendTo(this.$el);
 
+            this.unsent_orders_popup = new module.UnsentOrdersPopupWidget(this,{});
+            this.unsent_orders_popup.appendTo(this.$el);
+
             // --------  Misc ---------
 
             this.close_button = new module.HeaderButtonWidget(this,{
@@ -1144,6 +1150,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
                     'error-invoice-transfer': this.error_invoice_transfer_popup,
                     'error-traceback': this.error_traceback_popup,
                     'confirm': this.confirm_popup,
+                    'unsent-orders': this.unsent_orders_popup,
                 },
                 default_screen: 'products',
                 default_mode: 'cashier',
index 93f008f..45f567f 100644 (file)
         </div>
     </t>
 
+    <t t-name="UnsentOrdersPopupWidget">
+        <div class="modal-dialog">
+            <div class="popup popup-unsent-orders">
+                <p class="message">Unsent Orders</p>
+                <t t-if='widget.pos.db.get_orders().length === 0'>
+                    <p class='comment'>
+                        There are no unsent orders
+                    </p>
+                </t>
+                <t t-if='widget.pos.db.get_orders().length > 0'>
+                    <p class='comment traceback'>
+                        <t t-esc='JSON.stringify(widget.pos.db.get_orders(),null,2)' />
+                    </p>
+                </t>
+                <div class="footer">
+                    <div class="button confirm">
+                        Ok
+                    </div>
+                </div>
+            </div>
+        </div>
+    </t>
+
     <t t-name="Product">
         <span class='product' t-att-data-product-id="product.id">
             <div class="product-img">
                     <li class="button reference">Reference</li>
                 </ul>
 
+                <p class="category">Unsent Orders</p>
+                <ul>
+                    <li class="button show_orders">Show All Unsent Orders</li>
+                </ul>
+
                 <p class="category">Hardware Status</p>
                 <ul>
                     <li class="status weighting">Weighting</li>