Prechádzať zdrojové kódy

Qué imprima lo mismo que un ticket para la cocina

sebas 4 rokov pred
rodič
commit
b13a27efed
6 zmenil súbory, kde vykonal 65 pridanie a 25 odobranie
  1. 0 0
      __init__.py
  2. 0 0
      __init__.pyc
  3. 0 0
      __openerp__.py
  4. 9 5
      static/src/js/main.js
  5. 56 20
      static/src/xml/pos.xml
  6. 0 0
      views/pos_template.xml

+ 0 - 0
__init__.py


+ 0 - 0
__init__.pyc


+ 0 - 0
__openerp__.py


+ 9 - 5
static/src/js/main.js

@@ -17,7 +17,7 @@ openerp.eiru_kitchen_ticket = function (instance) {
             var back_button  = this.add_action_button({
                 label: _t('Back'),
                 icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
-                click: function(){  
+                click: function(){
                     self.back();
                 },
             });
@@ -63,18 +63,21 @@ openerp.eiru_kitchen_ticket = function (instance) {
                     add.push({
                         'id': product,
                         'name': this.pos.db.get_product_by_id(product).display_name,
+                        'price': this.pos.db.get_product_by_id(product).price,
                         'quantity': current[product],
                     });
                 }else if( old[product] < current[product]){
                     add.push({
                         'id': product,
                         'name': this.pos.db.get_product_by_id(product).display_name,
+                        'price': this.pos.db.get_product_by_id(product).price,
                         'quantity': current[product] - old[product],
                     });
                 }else if( old[product] > current[product]){
                     rem.push({
                         'id': product,
                         'name': this.pos.db.get_product_by_id(product).display_name,
+                        'price': this.pos.db.get_product_by_id(product).price,
                         'quantity': old[product] - current[product],
                     });
                 }
@@ -85,7 +88,8 @@ openerp.eiru_kitchen_ticket = function (instance) {
                     rem.push({
                         'id': product,
                         'name': this.pos.db.get_product_by_id(product).display_name,
-                        'quantity': old[product], 
+                        'price': this.pos.db.get_product_by_id(product).price,
+                        'quantity': old[product],
                     });
                 }
             }
@@ -107,7 +111,7 @@ openerp.eiru_kitchen_ticket = function (instance) {
 
                 var _add = [];
                 var _rem = [];
-                
+
                 for(var i = 0; i < add.length; i++){
                     if(product_in_category(add[i].id)){
                         _add.push(add[i]);
@@ -139,7 +143,7 @@ openerp.eiru_kitchen_ticket = function (instance) {
             }
             return false;
         },
-        
+
         refresh: function() {
             var self = this;
             var order = self.pos.get('selectedOrder');
@@ -148,7 +152,7 @@ openerp.eiru_kitchen_ticket = function (instance) {
             var table = ' ';
             if(place != undefined){
                 var floor = order.export_as_JSON().table.floor_id[1];
-                var table = order.export_as_JSON().table.name;  
+                var table = order.export_as_JSON().table.name;
             }
             var change = self.computeChanges();
             $('.pos-receipt-container', this.$el).html(QWeb.render('KitchenTicket',{

+ 56 - 20
static/src/xml/pos.xml

@@ -11,7 +11,7 @@
     <t t-name="KitchenTicketButton">
         <span class="control-button order-printbill">
             <i class="fa fa-print"></i>
-            Cocina
+            Ticket
         </span>
     </t>
     <t t-name="KitchenTicket">
@@ -23,46 +23,82 @@
             </div>
             <br/>
             <t t-if="widget.pos.company.name">
-                <strong><t t-esc="widget.pos.company.name"/></strong><br />
+                <strong><center><t t-esc="widget.pos.company.name"/></center></strong> <br/>
             </t>
-            User: <t t-esc="widget.pos.cashier ? widget.pos.cashier.name : widget.pos.user.name"/>
+            <t t-if="widget.pos.company.name">
+                <strong><center><t t-esc="widget.pos.company.phone"/></center></strong> <br/>
+            </t>
+               User: <t t-esc="widget.pos.cashier ? widget.pos.cashier.name : widget.pos.user.name"/>
             <t t-if="order.attributes.client">
                <br/>
-               Cliente: <t t-esc="order.attributes.client.name ? order.attributes.client.name : ''"/><br/>
-               Teléfono: <t t-esc="order.attributes.client.phone ? order.attributes.client.phone : ''"/><br/><br/>
+               Cliente: <t t-esc="order.attributes.client.name ? order.attributes.client.name : ''"/><br />
+               R.U.C. Nª: <t t-esc="order.attributes.client.ruc ? order.attributes.client.ruc : ''"/><br />
+               Tel: <t t-esc="order.attributes.client.phone ? order.attributes.client.phone : ''"/><br/>
+               <t t-if="order.attributes.client.address">
+                 Dir.: <t t-esc="order.attributes.client.address"/><br/>
+               </t>
+               <t t-if="order.attributes.table">
+                 <t t-if="order.attributes.table.type =='table'">
+                   Mesa: <t t-esc="order.attributes.table.name"/>
+                 </t>
+                 <t t-if="order.attributes.table.type =='delivery'">
+                   Delivery: <t t-esc="order.attributes.table.name"/>
+                 </t>
+               </t>
            </t>
             <br />
-            <div class="pos-center-align" style="font-size:25px;font-weight:bold">Cocina</div>
+            <div class="pos-center-align" style="font-size:25px;font-weight:bold">Ticket</div>
             <p>--------------------------------------------</p>
-            <table style="font-size:18px;">
+            <table style="font-size:16px;">
                 <tbody>
                     <colgroup>
-                        <col width='80%' />
-                        <col width='20%' />
+                      <col width='13%'/>
+                      <col width='38%'/>
+                      <col width='25%'/>
+                      <col width='25%'/>
                     </colgroup>
                     <t t-foreach="filterLines" t-as="item">
                        <tr>
-                            <td>
-                                <t t-esc="item.name"/>
-                            </td>
-                            <td class="pos-right-align">
-                                <t t-esc="item.quantity"/>
-                            </td>
-                        </tr>
-                        <tr>
-                            <td><p>-----------------------------------</p></td>
-                            <td><p>--------</p></td>
+                         <td>
+                             <t t-esc="item.quantity"/>
+                         </td>
+                         <td>
+                             <t t-esc="item.name"/>
+                         </td>
+                         <td>
+                             <t t-esc="item.price"/>
+                         </td>
+                         <td class="pos-right-align">
+                             <t t-esc="(item.price*item.quantity)"/>
+                         </td>
                         </tr>
+
                     </t>
+
                 </tbody>
             </table>
-            <div class="pos-center-align" style="font-size:22px;font-weight:bold"><t t-esc="floor"/> / <t t-esc="table"/></div><br/>
+            <table>
+              <tr>
+                  <td><p>---------------------------------</p></td>
+              </tr>
+                <tr class="emph">
+                    <br />
+                    <td>Total:</td>
+                    <td class="pos-right-align" style='font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;font-size: 20px;'>
+                        <t t-esc="widget.format_currency(order.getTotalTaxIncluded())"/>
+                    </td>
+                </tr>
+            </table>
+
+
+            <br/>
             <t t-if="widget.pos.config.receipt_footer">
                 <br />
                 <div style='text-align:center'>
                     <t t-esc="widget.pos.config.receipt_footer" />
                 </div>
             </t>
+
         </div>
     </t>
 </templates>

+ 0 - 0
views/pos_template.xml