Browse Source

IMpresión de ticket desde factura

Sebas 6 years ago
commit
8b873978ea

+ 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_venta_odontoimagen

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 Venta Odonto Imagen',
+    'version': '0.1',
+    'category': 'Product',
+    'description': """
+Ticket Venta Odonto Imagen
+==========================
+
+Formato para imprimir Ticket Venta Odonto Imagen
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': 'http://www.eiru.com',
+    'depends': ['base','account'],
+    'data': [
+        'ticket_venta_odontoimagen.xml'
+    ],
+    'installable': True,
+}

BIN
static/description/icon.png


+ 22 - 0
ticket_venta_odontoimagen.py

@@ -0,0 +1,22 @@
+from openerp import api, models
+import datetime
+from num2words import num2words
+
+class report_ticket_odontoimagen(models.AbstractModel):
+    _name = 'report.ticket_venta_odontoimagen.report_ticket_odontoimagen'
+
+    @api.multi
+    def render_html(self, data=None):
+        report_obj = self.env['report']
+        report = report_obj._get_report_from_name('ticket_venta_odontoimagen.report_ticket_odontoimagen')
+        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_venta_odontoimagen.report_ticket_odontoimagen', docargs)
+
+
+    def calcular_precio(self,precio):
+        return (precio*1.1)

BIN
ticket_venta_odontoimagen.pyc


+ 210 - 0
ticket_venta_odontoimagen.xml

@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+     <report id="ticket_venta_odontoimagen"
+        model="account.invoice"
+        string="Ticket"
+        report_type="qweb-html"
+        name="ticket_venta_odontoimagen.report_ticket_odontoimagen"
+        file="ticket_venta_odontoimagen.report_ticket_odontoimagen"
+     />
+
+    <record id="paperformat_lowmargin" model="report.paperformat">
+         <field name="name">Ticket Odonto</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_venta_odontoimagen.ticket_venta_odontoimagen" model="ir.actions.report.xml">
+        <field name="paperformat_id" ref="ticket_venta_odontoimagen.paperformat_lowmargin" />
+    </record>
+
+    <template id="report_ticket_odontoimagen">
+        <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">
+
+                            <!--
+                            ======================================================================
+                                CABECERA
+                            ======================================================================
+                            -->
+                            <div style="height:1.5cm;">
+                                <div style="width:14cm;padding-top:0.4cm;padding-right:5.0cm;font-size:9.5px;font-family: Arial;text-align: center;">
+                                    <div>
+                                        <span t-field="o.create_date" t-options='{"format": "dd/mm/aaaa hh.mm.ss"}'/>
+                                    </div>
+                                    <!-- <div>
+                                       <span t-esc="time.strftime('%m/%d/%Y',time.strptime(object.datetimefield,'%Y-%m-%d %H:%M:%S'))"/>
+                                    </div> -->
+                                    <div>
+                                        <span t-field="o.name"/>-<span t-field="o.user_id"/>
+                                    </div>
+                                </div>
+                            </div>
+                            <div style="height:0.5cm;">
+                                <div style="font-size:11px;font-family: Arial;">
+                                    <div style="text-align: center;">
+                                        <b>ODONTOIMAGEN</b>
+                                    </div>
+                                </div>
+                            </div>
+                            <div style="height:1.5cm;">
+                                <div style="width:12cm;padding-right:5.0cm;font-size:9.5px;font-family: Arial;">
+                                    <div>
+                                        <b>Cliente: </b><span t-field="o.partner_id.name"/>
+                                        &amp;nbsp;&amp;nbsp;
+                                        <span t-field="o.partner_id.ruc"/>
+                                    </div>
+                                    <div>
+                                        <b>Teléfono: </b><span t-field="o.partner_id.mobile"/>
+                                    </div>
+                                </div>
+                            </div>
+                            <!--
+                            ======================================================================
+                                TABLA
+                            ======================================================================
+                            -->
+                            <div style="height:3.1cm;">
+                                <div style="font-family: Arial;">
+                                    <table class="table table-condensed table-bordered">
+                                        <thead>
+                                            <tr>
+                                                <th style="font-size:10px;font-family: Arial;width:1.3cm;overflow: auto; text-align: center;"><b>Cant.</b></th>
+                                                <th style="font-size:10px;font-family: Arial;width:9.5cm;overflow: auto; text-align: left;"><b>Producto</b></th>
+                                                <th style="font-size:10px;font-family: Arial;width:1.9cm;overflow: auto; text-align: center;"><b>Precio</b></th>
+                                            </tr>
+                                        </thead>
+
+                                        <tbody>
+                                            <tr t-foreach="o.invoice_line" t-as="l">
+
+                                                <!-- CANTIDAD -->
+                                                <td style="font-size:10px;font-family: Arial;width:1.3cm;overflow: auto; text-align: center;">
+                                                    <span t-esc="'%.0f'%l.quantity"/>
+                                                </td>
+
+                                                <!-- NOMBRE DEL PRODUCTO -->
+                                                <td style="font-size:10px;font-family: Arial;width:9.5cm;overflow: auto;">
+                                                    <span t-field="l.name"/>
+                                                </td>
+                                                <!-- PRECIO UNITARIO -->
+                                                <td style="font-size:10px;font-family: Arial;width:1.7cm;overflow: auto; text-align: right;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <span t-esc="'{0:,.0f}'.format(l.quantity * l.price_unit)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <span t-esc="'{0:,.2f}'.format(l.quantity * l.price_unit)"/>
+                                                    </t>
+                                                </td>
+                                           </tr>
+                                        </tbody>
+                                    </table>
+                                </div>
+                            </div>
+
+                            <table class="table table-condensed">
+
+                                <tbody>
+                                    <tr>
+                                        <td style="font-size:10px;font-family: Arial;width:1.3cm;overflow: auto; text-align: left;">
+                                            <b>Sub Total: </b>
+                                        </td>
+
+                                        <!-- NOMBRE DEL PRODUCTO -->
+                                        <td style="font-size:10px;font-family: Arial;width:9.5cm;overflow: auto;">
+
+                                        </td>
+                                        <!-- PRECIO UNITARIO -->
+                                        <td style="font-size:10px;font-family: Arial;width:1.7cm;overflow: auto; text-align: right;">
+                                            <span t-field="o.amount_total"/>
+                                        </td>
+                                   </tr>
+                                   <tr>
+                                       <td style="font-size:10px;font-family: Arial;width:1.3cm;overflow: auto; text-align: left;">
+                                            <b>Descuento: </b>
+                                       </td>
+
+                                       <!-- NOMBRE DEL PRODUCTO -->
+                                       <td style="font-size:10px;font-family: Arial;width:9.5cm;overflow: auto;">
+
+                                       </td>
+                                       <!-- PRECIO UNITARIO -->
+                                       <td style="font-size:10px;font-family: Arial;width:1.7cm;overflow: auto; text-align: right;">
+
+                                       </td>
+                                  </tr>
+                                  <tr>
+                                      <td style="font-size:10px;font-family: Arial;width:1.3cm;overflow: auto; text-align: left;">
+                                          <b>Total: </b>
+                                      </td>
+
+                                      <!-- NOMBRE DEL PRODUCTO -->
+                                      <td style="font-size:10px;font-family: Arial;width:9.5cm;overflow: auto;">
+
+                                      </td>
+                                      <!-- PRECIO UNITARIO -->
+                                      <td style="font-size:10px;font-family: Arial;width:1.7cm;overflow: auto; text-align: right;">
+                                          <span t-field="o.amount_total"/>
+                                      </td>
+                                 </tr>
+                                </tbody>
+                            </table>
+
+                                    <div style="width:12cm;font-size:9.5px;font-family: Arial;">
+                                        <span t-field="o.journal_id.name"/> - <span t-field="o.currency_id.name"/>
+                                    </div>
+                                    <div style="text-align: center;">
+                                        <b>www.eiru.com.py</b>
+                                    </div>
+                        </div>
+                    </t>
+
+                </div>
+            <!-- </t> -->
+        </t>
+
+    </template>
+
+</data>
+</openerp>