Selaa lähdekoodia

[FIX] correccion en la impresion

Rodney Elpidio Enciso Arias 6 vuotta sitten
vanhempi
commit
4d7c669867
2 muutettua tiedostoa jossa 10 lisäystä ja 29 poistoa
  1. 4 18
      static/src/js/screen.js
  2. 6 11
      static/src/xml/pos_receipt.xml

+ 4 - 18
static/src/js/screen.js

@@ -33,23 +33,6 @@ openerp.eiru_ticket_bill_kitchen = function (instance) {
                 this.print();
             }
 
-            //
-            // The problem is that in chrome the print() is asynchronous and doesn't
-            // execute until all rpc are finished. So it conflicts with the rpc used
-            // to send the orders to the backend, and the user is able to go to the next
-            // screen before the printing dialog is opened. The problem is that what's
-            // printed is whatever is in the page when the dialog is opened and not when it's called,
-            // and so you end up printing the product list instead of the receipt...
-            //
-            // Fixing this would need a re-architecturing
-            // of the code to postpone sending of orders after printing.
-            //
-            // But since the print dialog also blocks the other asynchronous calls, the
-            // button enabling in the setTimeout() is blocked until the printing dialog is
-            // closed. But the timeout has to be big enough or else it doesn't work
-            // 2 seconds is the same as the default timeout for sending orders and so the dialog
-            // should have appeared before the timeout... so yeah that's not ultra reliable.
-
             finish_button.set_disabled(true);
             setTimeout(function(){
                 finish_button.set_disabled(false);
@@ -67,18 +50,21 @@ openerp.eiru_ticket_bill_kitchen = function (instance) {
             var order = this.pos.get('selectedOrder');
             var categories = this.pos.printers[0].config.product_categories_ids;
             var orderlines = order.get('orderLines').models;
+
             _.each(orderlines, function(item){
                 for (var i = 0; i < categories.length; i++) {
                     if(item.product.pos_categ_id[0] == categories[i]){
                         data.push({
                             product_id: item.product.id,
                             product_name: item.product.display_name,
-                            product_description: item.product.description,
+                            product_pack_lines: item.pack_lines,
                             product_qty: ' --> ' + item.quantity,
+                            line_id: item.id,
                         })
                     }
                 }
             });
+
             $('.pos-receipt-container', this.$el).html(QWeb.render('PosTicket',{
                 widget:this,
                 order: order,

+ 6 - 11
static/src/xml/pos_receipt.xml

@@ -124,23 +124,18 @@
                             <tr>
                                 <td>
                                     <t t-esc="kitchenline.product_name"/>
-                                    <t t-esc="orderlines[0].order.uid"/>
-                                    <t t-="kitchenline.product_description !== false">
-                                        <t t-foreach="kitchenline.product_description" t-as="item">
-                                            <t t-if="orderlines[0].order.uid == item.order">
-                                                <ul>
-                                                    <li><t t-esc="item.product_name"/></li>
-                                                </ul>   
-                                            </t>
-                                        </t>    
-                                    </t>
+                                    <t t-foreach="kitchenline.product_pack_lines" t-as="item">
+                                        <ul>
+                                            <li><t t-esc="item.product_name"/></li>
+                                        </ul>   
+                                    </t>    
                                 </td>
                                 <td>
                                     <t t-esc="kitchenline.product_qty"/>
                                 </td>
                             </tr>
                             <tr>
-                                <td>-------------------------------------</td>
+                                <td>------------------------------------------</td>
                                 <td></td>
                             </tr>
                         </t>