Browse Source

Impresión de ticket en pedido de venta

sebas 4 years ago
commit
3a0abda8c4
6 changed files with 213 additions and 0 deletions
  1. 18 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 39 0
      __openerp__.py
  4. BIN
      static/description/icon.png
  5. 22 0
      ticket_orden_imperio.py
  6. 134 0
      ticket_orden_imperio.xml

+ 18 - 0
__init__.py

@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    This program is free software: you can redistribute it and/or modify       #
+#    it under the terms of the GNU Affero General Public License as             #
+#    published by the Free Software Foundation, either version 3 of the         #
+#    License, or (at your option) any later version.                            #
+#                                                                               #
+#    This program is distributed in the hope that it will be useful,            #
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of             #
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              #
+#    GNU Affero General Public License for more details.                        #
+#                                                                               #
+#    You should have received a copy of the GNU Affero General Public License   #
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.      #
+#                                                                               #
+###################################################################################
+from . import ticket_orden_imperio

BIN
__init__.pyc


+ 39 - 0
__openerp__.py

@@ -0,0 +1,39 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    This program is free software: you can redistribute it and/or modify       #
+#    it under the terms of the GNU Affero General Public License as             #
+#    published by the Free Software Foundation, either version 3 of the         #
+#    License, or (at your option) any later version.                            #
+#                                                                               #
+#    This program is distributed in the hope that it will be useful,            #
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of             #
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              #
+#    GNU Affero General Public License for more details.                        #
+#                                                                               #
+#    You should have received a copy of the GNU Affero General Public License   #
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.      #
+#                                                                               #
+#################################################################################
+###################################################################################
+# Product features is an Openobject module wich enable features management for products #
+###################################################################################
+{
+    'name': 'Ticket Orden Imperio',
+    'version': '0.1',
+    'category': 'Product',
+    'description': """
+Ticket Orden Imperio
+==========================
+
+Formato para imprimir Ticket Orden Imperio
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': 'http://www.eiru.com',
+    'depends': ['base','sale'],
+    'data': [
+        'ticket_orden_imperio.xml'
+    ],
+    'installable': True,
+}

BIN
static/description/icon.png


+ 22 - 0
ticket_orden_imperio.py

@@ -0,0 +1,22 @@
+from openerp import api, models
+import datetime
+from num2words import num2words
+
+class report_ticket_ordenimperio(models.AbstractModel):
+    _name = 'report.ticket_orden_imperio.report_ticket_ordenimperio'
+
+    @api.multi
+    def render_html(self, data=None):
+        report_obj = self.env['report']
+        report = report_obj._get_report_from_name('ticket_orden_imperio.report_ticket_ordenimperio')
+        docargs = {
+            'doc_ids': self._ids,
+            'doc_model': report.model,
+            'docs': self.env[report.model].browse(self._ids),
+            'calcular_precio':self.calcular_precio,
+        }
+        return report_obj.render('ticket_orden_imperio.report_ticket_ordenimperio', docargs)
+
+
+    def calcular_precio(self,precio):
+        return (precio*1.1)

+ 134 - 0
ticket_orden_imperio.xml

@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+     <report id="ticket_orden_imperio"
+        model="sale.order"
+        string="Ticket"
+        report_type="qweb-html"
+        name="ticket_orden_imperio.report_ticket_ordenimperio"
+        file="ticket_orden_imperio.report_ticket_ordenimperio"
+     />
+
+    <record id="paperformat_lowmargin" model="report.paperformat">
+         <field name="name">Ticket Imperio</field>
+         <field name="default" eval="True" />
+         <field name="format">custom</field>
+         <field name="page_height">150</field>
+         <field name="page_width">60</field>
+         <field name="orientation">Portrait</field>
+         <field name="margin_top">3</field>
+         <field name="margin_bottom">3</field>
+         <field name="margin_left">3</field>
+         <field name="margin_right">3</field>
+         <field name="header_line" eval="False" />
+         <field name="header_spacing">3</field>
+         <field name="dpi">90</field>
+    </record>
+
+    <record id="ticket_orden_imperio.ticket_orden_imperio" model="ir.actions.report.xml">
+        <field name="paperformat_id" ref="ticket_orden_imperio.paperformat_lowmargin" />
+    </record>
+
+    <template id="report_ticket_ordenimperio">
+        <t t-call="report.html_container">
+			<!-- <t t-foreach="[1,2,3]" t-as="i"> -->
+
+                <div class="page">
+                    <style>
+                        .logo{
+                            height: 1.71cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .table-condensed>tbody>tr>td {
+                            padding: 1px !important;
+                        }
+
+                        .borderless td, .borderless th {
+                            border: none !important;
+                        }
+                        .logo1{
+                            height: 2.61cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .logo2{
+                            height: 3.30cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                    </style>
+
+                    <t t-foreach="docs" t-as="o">
+                        <div class="pagina">
+                            <div class="row">
+                                <div class="col-xs-4">
+                                    <!--
+                                    ======================================================================
+                                        CABECERA
+                                    ======================================================================
+                                    -->
+                                    <div style="height:1.5cm;">
+                                        <div style="width:12cm;padding-top:0.4cm;padding-right:5.0cm;font-size:9.5px;font-family: Arial;text-align: center;">
+                                            <div>
+                                                <span t-field="o.date_order" t-options='{"format": "dd/mm/aaaa hh.mm.ss"}'/>
+                                            </div>
+
+                                            <div>
+                                                <span t-field="o.name"/>-<span t-field="o.user_id"/>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div style="height:1.0cm;">
+                                        <div style="width:12cm;font-size:12px;font-family: Arial;padding-right:5.0cm;">
+                                            <div style="text-align: center;">
+                                                <b>      FERRETERIA IMPERIO</b>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div style="height:1.5cm;">
+                                        <div style="width:12cm;padding-right:5.0cm;font-size:10.5px;font-family: Arial;">
+                                            <div>
+                                                &amp;nbsp;&amp;nbsp;
+                                                <b>Cliente: </b><span t-field="o.partner_id.name"/>
+                                            </div>
+                                            <div>
+                                                &amp;nbsp;&amp;nbsp;
+                                                <b>C.I.Nº / R.U.C.: </b><span t-field="o.partner_id.ruc"/>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div style="height:1.5cm;">
+                                        <div style="width:12cm;padding-center:5.0cm;font-size:18.5px;font-family: Arial;">
+                                            <div>
+                                                <b>Nº: </b><span t-field="o.name"/>
+                                                &amp;nbsp;&amp;nbsp;
+                                            </div>
+                                        </div>
+                                    </div>
+
+                                    <div style="height:1.5cm;">
+                                        <div style="width:12cm;text-align: left;font-size:12.5px;font-family: Arial;">
+                                            <div>
+                                                 <b>Monto: </b><span t-esc="'{0:,.0f}'.format(o.amount_total)"/>
+                                            </div>
+                                        </div>
+                                    </div>
+
+                                    <div style="width:12cm;padding-right:5.0cm;text-align: left;font-size:10.5px;font-family: Arial;">
+                                         <b>SOLICITE EN CAJA SU FACTURA LEGAL</b>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </t>
+
+                </div>
+
+            </t>
+
+    </template>
+
+</data>
+</openerp>