[WIP] point_of_sale: in progress of solving bugs in taxes and order editing, part 2
authorFrédéric van der Essen <fva@openerp.com>
Wed, 23 Jan 2013 18:32:05 +0000 (19:32 +0100)
committerFrédéric van der Essen <fva@openerp.com>
Wed, 23 Jan 2013 18:32:05 +0000 (19:32 +0100)
bzr revid: fva@openerp.com-20130123183205-7krkee3ihqg1hhmo

addons/point_of_sale/static/src/css/pos.css
addons/point_of_sale/static/src/js/models.js
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 f79a159..9d7a7c0 100644 (file)
     margin-bottom:10px;
 }
 .point-of-sale .order .summary .line{
+    float: right;
     margin-right:15px;
+    margin-left: 15px;
     padding-top:5px;
     border-top: solid 2px;
     border-color:#777;
 }
+.point-of-sale .order .summary .line .subentry{
+    font-size: 10px;
+    font-weight: normal;
+    text-align: center;
+}
 .point-of-sale .order .summary .line.empty{
+    text-align: right;
     border-color:#BBB;
     color:#999;
 }
index e0ec315..d4b1df3 100644 (file)
@@ -704,10 +704,10 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
             }), 0);
         },
         getChange: function() {
-            return this.getPaidTotal() - this.getTotal();
+            return this.getPaidTotal() - this.getTotalTaxIncluded();
         },
         getDueLeft: function() {
-            return this.getTotal() - this.getPaidTotal();
+            return this.getTotalTaxIncluded() - this.getPaidTotal();
         },
         // sets the type of receipt 'receipt'(default) or 'invoice'
         set_receipt_type: function(type){
@@ -763,7 +763,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
             return {
                 orderlines: orderlines,
                 paymentlines: paymentlines,
-                total_with_tax: this.getTotal(),
+                total_with_tax: this.getTotalTaxIncluded(),
                 total_without_tax: this.getTotalTaxExcluded(),
                 total_tax: this.getTax(),
                 total_paid: this.getPaidTotal(),
@@ -808,7 +808,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
             return {
                 name: this.getName(),
                 amount_paid: this.getPaidTotal(),
-                amount_total: this.getTotal(),
+                amount_total: this.getTotalTaxIncluded(),
                 amount_tax: this.getTax(),
                 amount_return: this.getChange(),
                 lines: orderLines,
index 0ce4f0c..eb2250d 100644 (file)
@@ -973,13 +973,13 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
             this.$('#payment-paid-total').html(paidTotal.toFixed(2));
             this.$('#payment-remaining').html(remaining.toFixed(2));
             this.$('#payment-change').html(change.toFixed(2));
-            if((currentOrder.selected_orderline == undefined))
-                remaining = 1
+            if(currentOrder.selected_orderline === undefined){
+                remaining = 1;  // What is this ? 
+            }
                 
             if(this.pos_widget.action_bar){
                 this.pos_widget.action_bar.set_button_disabled('validation', remaining > 0);
             }
-            this.$('.paymentline-amount input:last').focus();
         },
         set_numpad_state: function(numpadState) {
                if (this.numpadState) {
index 643f7d6..d9e57d0 100644 (file)
@@ -269,12 +269,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
         },
         update_summary: function(){
             var order = this.pos.get('selectedOrder');
-            var subtotal  = order ? order.getSubtotal() : 0;
             var total     = order ? order.getTotalTaxIncluded() : 0;
             var taxes     = order ? total - order.getTotalTaxExcluded() : 0;
-            this.$('.summary .value.subtotal').html(this.format_currency(subtotal));
-            this.$('.summary .value.taxes').html(this.format_currency(taxes));
-            this.$('.summary .value.total').html(this.format_currency(total));
+            this.$('.summary .total > .value').html(this.format_currency(total));
+            this.$('.summary .total .subentry .value').html(this.format_currency(taxes));
         },
         set_display_mode: function(mode){
             if(this.display_mode !== mode){
index 8a175d2..db63030 100644 (file)
 
                     </ul>
                     <div class="summary">
-                        <span t-attf-class="line #{widget.pos.get('selectedOrder').get('orderLines').length === 0 ? 'empty' : ''}">
-                            <span class='entry subtotal'>
-                                <span class="label subtotal">Subtotal:</span> <span class="value subtotal">0.00 €</span>
-                            </span>
-                            <span class='entry taxes'>
-                                <span class="label taxes">Taxes:</span> <span class="value taxes">0.00€</span>
-                            </span>
-                            <span class='entry total'>
-                                <span class="label total">Total:</span> <span class="value total">0.00 €</span>
-                            </span>
-                        </span>
+                        <div t-attf-class="line #{widget.pos.get('selectedOrder').get('orderLines').length === 0 ? 'empty' : ''}">
+                            <div class='entry total'>
+                                <span class="label">Total: </span> <span class="value">0.00 €</span>
+                                <div class='subentry'>Taxes: <span class="value">0.00€</span></div>
+                            </div>
+                        </div>
+                        <div class='clear'></div>
                     </div>
                 </div>
             </div>