Forráskód Böngészése

Impresión de ticket venta gracia

Sebas 5 éve
commit
7b4d9c14d5
7 módosított fájl, 301 hozzáadás és 0 törlés
  1. 18 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 39 0
      __openerp__.py
  4. BIN
      static/description/icon.png
  5. 22 0
      ticket_venta_gracia.py
  6. BIN
      ticket_venta_gracia.pyc
  7. 222 0
      ticket_venta_gracia.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_venta_gracia

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

BIN
static/description/icon.png


+ 22 - 0
ticket_venta_gracia.py

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

BIN
ticket_venta_gracia.pyc


+ 222 - 0
ticket_venta_gracia.xml

@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+     <report id="ticket_venta_gracia"
+        model="sale.order"
+        string="Ticket"
+        report_type="qweb-html"
+        name="ticket_venta_gracia.report_ticket_gracia"
+        file="ticket_venta_gracia.report_ticket_gracia"
+     />
+
+    <record id="paperformat_lowmargin" model="report.paperformat">
+         <field name="name">Ticket Gracia</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_gracia.ticket_venta_gracia" model="ir.actions.report.xml">
+        <field name="paperformat_id" ref="ticket_venta_gracia.paperformat_lowmargin" />
+    </record>
+
+    <template id="report_ticket_gracia">
+        <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:13cm;padding-top:0.4cm;padding-right:4.4cm;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:1.5cm;">
+                                        <div style="font-size:11px;font-family: Arial;">
+                                            <div style="text-align: center;">
+                                                <b><center><span t-field="o.company_id.name"/></center></b>
+                                            </div>
+                                        </div>
+                                        <div style="font-size:8px;font-family: Arial;">
+                                            <div style="text-align: center;">
+                                                <b><center><span t-field="o.company_id.street"/></center></b>
+                                            </div>
+                                        </div>
+                                        <div style="font-size:8px;font-family: Arial;">
+                                            <div style="text-align: center;">
+                                                <b><center><span t-field="o.company_id.phone"/></center></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.order_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.product_uom_qty"/>
+                                                        </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.product_uom_qty * l.price_unit)"/>
+                                                            </t>
+                                                            <t t-if="o.currency_id.id != 166">
+                                                                <span t-esc="'{0:,.2f}'.format(l.product_uom_qty * 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-esc="'{0:,.0f}'.format(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-esc="'{0:,.0f}'.format(o.amount_total)"/>
+                                              </td>
+                                         </tr>
+                                        </tbody>
+                                    </table>
+
+                                            <div style="width:12cm;font-size:9.5px;font-family: Arial;">
+                                                <span t-field="o.payment_term"/> - <span t-field="o.currency_id.name"/>
+                                            </div>
+
+                                </div>
+                            </div>
+                        </div>
+                    </t>
+
+                </div>
+
+            <!-- </t> -->
+            </t>
+
+    </template>
+
+</data>
+</openerp>