ticket_template.xml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <openerp>
  3. <data>
  4. <template id="ticket_venta_template">
  5. <!-- NOTA: no llamamos a web.assets_frontend porque en Odoo8 puede no existir -->
  6. <t t-set="layout" t-value="None"/>
  7. <html>
  8. <head>
  9. <meta charset="utf-8"/>
  10. <title>Ticket</title>
  11. <style type="text/css">
  12. @page { size: 78mm auto; margin: 0; }
  13. html, body { padding: 0; margin: 0; }
  14. .page {
  15. width: 78mm;
  16. font-family: monospace;
  17. font-size: 12px;
  18. line-height: 1.2;
  19. padding: 2mm 2mm;
  20. box-sizing: border-box;
  21. }
  22. .center { text-align: center; }
  23. .right { text-align: right; }
  24. .divider { border-top: 1px dashed #000; margin: 3px 0; }
  25. table { width: 100%; border-collapse: collapse; }
  26. th, td { padding: 0; vertical-align: top; }
  27. .qty { width: 18%; }
  28. .desc { width: 52%; }
  29. .tot { width: 30%; text-align: right; white-space: nowrap; }
  30. </style>
  31. </head>
  32. <body>
  33. <div class="page">
  34. <div class="center">
  35. <strong><t t-esc="doc.company_id and doc.company_id.name or ''"/></strong><br/>
  36. <t t-esc="doc.company_id and (doc.company_id.actividad or '') or ''"/><br/>
  37. <t t-esc="doc.company_id and (doc.company_id.street or '') or ''"/><br/>
  38. <t t-esc="doc.company_id and (doc.company_id.street2 or '') or ''"/><br/>
  39. <t t-if="doc.company_id and doc.company_id.phone">Tel: <t t-esc="doc.company_id.phone"/></t><br/>
  40. -------------------------------
  41. </div>
  42. <div>
  43. <strong>Factura:</strong> <t t-esc="doc.number or doc.name or ''"/><br/>
  44. <strong>Cliente:</strong> <t t-esc="doc.partner_id and doc.partner_id.name or ''"/><br/>
  45. <t t-if="doc.date_invoice"><strong>Fecha:</strong> <t t-esc="doc.date_invoice"/></t>
  46. <div class="divider"></div>
  47. </div>
  48. <table>
  49. <thead>
  50. <tr>
  51. <th class="qty">Cant</th>
  52. <th class="desc">Descripción</th>
  53. <th class="tot">Total</th>
  54. </tr>
  55. </thead>
  56. <tbody>
  57. <tr t-foreach="doc.invoice_line" t-as="line">
  58. <td class="qty"><t t-esc="'{0:,.0f}'.format(line.quantity)"/></td>
  59. <td class="desc"><t t-esc="line.name"/></td>
  60. <td class="tot"><t t-esc="'{0:,.0f}'.format(line.quantity * line.price_unit)"/></td>
  61. </tr>
  62. </tbody>
  63. </table>
  64. <div class="divider"></div>
  65. <div class="right">
  66. <strong>Total:</strong> <t t-esc="'{0:,.0f}'.format(doc.amount_total)"/>
  67. </div>
  68. <div class="center" style="margin-top:6px;">¡Gracias por su compra!</div>
  69. </div>
  70. <script type="text/javascript">
  71. window.onload = function() {
  72. try { window.print(); } catch(e) {}
  73. setTimeout(function(){ window.close(); }, 500);
  74. };
  75. </script>
  76. </body>
  77. </html>
  78. </template>
  79. </data>
  80. </openerp>