Explorar el Código

Módulo para imprimir presupuesto de venta de baco

SEBAS hace 1 mes
commit
ef2be2ec9f

+ 19 - 0
__init__.py

@@ -0,0 +1,19 @@
+# -*- 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 presupuesto_venta_baco

BIN
__init__.pyc


+ 37 - 0
__openerp__.py

@@ -0,0 +1,37 @@
+# -*- 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/>.      #
+#                                                                               #
+#################################################################################
+
+{
+    'name': 'Presupuesto de Venta baco',
+    'version': '0.1',
+    'category': 'Sale',
+    'description': """
+Presupuesto de Venta baco
+
+
+Formato para imprimir el Presupuesto de Venta baco
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': 'http://www.eiru.com.py',
+    'depends': ['base','sale'],
+    'data': [
+	    'presupuesto_venta_baco.xml'
+    ],
+    'installable': True,
+}

+ 30 - 0
presupuesto_venta_baco.py

@@ -0,0 +1,30 @@
+from openerp import api, models
+import datetime
+from num2words import num2words
+
+class report_presupuesto_baco(models.AbstractModel):
+    _name = 'report.presupuesto_venta_baco.report_presupuesto_baco'
+
+    @api.multi
+    def render_html(self, data=None):
+        report_obj = self.env['report']
+        report = report_obj._get_report_from_name('presupuesto_venta_baco.report_presupuesto_baco')
+        docargs = {
+            'doc_ids': self._ids,
+            'doc_model': report.model,
+            'docs': self.env[report.model].browse(self._ids),
+            'convertir':self.convertir,
+            'calcular_precio':self.calcular_precio,
+        }
+        return report_obj.render('presupuesto_venta_baco.report_presupuesto_baco', docargs)
+
+    def convertir(self,nro,moneda):
+        letra = num2words(nro,lang="es")
+        letra = letra.capitalize()
+        if not moneda:
+            moneda=''
+        letra = letra +' '+moneda
+        return letra
+
+    def calcular_precio(self,precio):
+        return (precio*1.1)

BIN
presupuesto_venta_baco.pyc


+ 351 - 0
presupuesto_venta_baco.xml

@@ -0,0 +1,351 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <report id="presupuesto_venta_baco"
+        model="sale.order"
+        string="Presupuesto de Venta"
+        report_type="qweb-pdf"
+        name="presupuesto_venta_baco.report_presupuesto_baco"
+        file="presupuesto_venta_baco.report_presupuesto_baco"
+    />
+
+
+    <template id="report_header_custom" inherit_id="report.external_layout_header">
+         <xpath expr="//div[@class='header']" position="replace">
+            <div class ="header">
+            </div>
+         </xpath>
+    </template>
+
+    <template id="external_layout_footer" inherit_id="report.external_layout_footer">
+        <xpath expr="//div[@class='footer']"  position="replace">
+            <div class ="footer">
+            </div>
+        </xpath>
+    </template>
+
+
+
+
+   <template id="report_presupuesto_baco">
+     <t t-call="report.html_container">
+        <t t-call="report.external_layout">
+            <div class="page">
+                <style type="text/css">
+                  body {
+                      font-size: 3.2mm;
+                      font-family: Arial;
+                      margin: 0; /* Elimina cualquier margen predeterminado del navegador */
+                    }
+                    div {
+                        padding: 0px;
+                    }
+                    .pagina {
+                        width: 100%;   /* Deja un margen de 2 cm en cada lado */
+                        margin: 0 auto; /* Centra la página */
+                        padding: 0;
+                        padding-left: 2cm; /* Márgen izquierdo */
+                        padding-right: 1cm; /* Márgen derecho */
+                        height: 21cm; /* Ajusta la altura de la página si es necesario */
+                    }
+                    .descripcion{
+                        width: 11.2cm;
+                        font-size: 13px;
+                        padding-top: 0.5cm;
+                        float: left;
+                        min-height: 0cm;
+                    }
+
+                    .descripcion1{
+                        width: 11.2cm;
+                        font-size: 17px;
+                        padding-top: 0.2cm;
+                        padding-left: 0.2cm;
+                        float: left;
+                        min-height: 0cm;
+                    }
+
+                    .descripcion11{
+                        width: 11.2cm;
+                        font-size: 17px;
+                        padding-left: 0.2cm;
+                        padding-top: 0.1cm;
+                        float: left;
+                        min-height: 0cm;
+                    }
+
+                    .descripcion2{
+                        width: 13cm;
+                        padding-left: 0.2cm;
+                        font-size: 10px;
+                        float: left;
+                        min-height: 0cm;
+                    }
+
+                    .descripcion3{
+                        width: 15cm;
+                        font-size: 10px;
+                        padding-left: 0.2cm;
+                        float: left;
+                        min-height: 0cm;
+                    }
+                    .descripcion4{
+                        width: 15cm;
+                        font-size: 10px;
+                        padding-left: 0.2cm;
+                        float: left;
+                        min-height: 0cm;
+                    }
+
+                    .email{
+                        width: 13cm;
+                        font-size: 10px;
+                        padding-left: 0.2cm;
+                        float: left;
+                        min-height: 0cm;
+                    }
+
+                    .ciudad{
+                        width: 13cm;
+                        float: left;
+                        padding-left: 0.2cm;
+                        font-size: 10px;
+                        min-height: 0cm;
+                    }
+                    .tel{
+                        width: 13cm;
+                        float: left;
+                        padding-left: 0.2cm;
+                        font-size: 10px;
+                        min-height: 0cm;
+                    }
+                    .rucdata{
+                        width: 13cm;
+                        float: left;
+                        padding-left: 0.2cm;
+                        font-size: 10px;
+                        min-height: 0cm;
+                    }
+                    .table-condensed>tbody>tr>td {
+                        padding: 1px !important;
+                    }
+                    .divisoria{
+                        height: 0.5cm;
+                        clear: both;
+                    }
+                    .titulo{
+                        width: 19.2cm;
+                        text-align: center;
+                        width: 100%;
+                        min-height: 0.9cm;
+                    }
+                    .fecha_emision_data{
+                        width: 12.5cm;
+                        float: left;
+                        min-height: 0.5cm;
+                    }
+                    .vendor{
+                        width: 6.7cm;
+                        float: left;
+                        min-height: 0.5cm;
+                    }
+
+                    .razon_data{
+                        width: 12.5cm;
+                        float: left;
+                        min-height: 0.4cm;
+                    }
+                    .ruc_data{
+                        width: 6.7cm;
+                        float: left;
+                        min-height: 0.4cm;
+                    }
+                    .direccion_data{
+                        width: 19.2cm;
+                        float: left;
+                        min-height: 0.4cm;
+                    }
+                    .telefono_data{
+                        width: 19.2cm;
+                        float: left;
+                        min-height: 0.4cm;
+                    }
+
+                    .note{
+                        width: 19.2cm;
+                        float: left;
+                        min-height: 0.4cm;
+                    }
+                    .divisoria1{
+                        height: 0.3cm;
+                        clear: both;
+                    }
+                    .cab-articulos{
+                        height: 0.4cm;
+                        clear: both;
+                    }
+                    .articulos{
+                        height: 4.5cm;
+                    }
+                    .art-col1{
+                        width:2.3cm;
+                        text-align: center;
+                    }
+                    .art-col2{
+                        width:11.3cm;
+                        text-align: left;
+                    }
+                    .art-col3{
+                        padding-left: 0.5cm;
+                        width:3cm;
+                        text-align: right;
+                    }
+                    .art-col4{
+                        padding-left: 0.5cm;
+                        width:3cm;
+                        text-align: right;
+                    }
+
+                    .spad{
+                        width: 8.5cm;
+                        float: left;
+                        padding-top: 0.09cm;
+                        padding-bottom: 0.12cm;
+                        min-height: 0.4cm;
+                    }
+
+                    .sub_total{
+                        width: 11cm;
+                        text-align: right;
+                        padding-top: 0.09cm;
+                        padding-left: 9.5cm;
+                        padding-bottom: 0.12cm;
+                        min-height: 0.4cm;
+                    }
+                    .total_iva{
+                        width: 11cm;
+                        text-align: right;
+                        padding-top: 0.09cm;
+                        padding-left: 9.5cm;
+                        padding-bottom: 0.12cm;
+                        min-height: 0.4cm;
+                    }
+                    .total_total{
+                        width: 11cm;
+                        text-align: right;
+                        padding-top: 0.09cm;
+                        padding-left: 9.5cm;
+                        padding-bottom: 0.12cm;
+                        min-height: 0.4cm;
+                    }
+                    .total_pagar_data{
+                        width: 19.2cm;
+                        float: left;
+                        min-height: 0.4cm;
+                    }
+                    .logo1{
+                        height: 2cm;
+                        width: 100%;
+                        top: 0px;
+                    }
+
+                </style>
+
+                <t t-foreach="docs" t-as="o">
+                    <div class="pagina">
+
+                        <div class="col-xs-12" style="font-size: 11px; padding-left: 0.01mm; padding-top: 0.01mm; padding-bottom: 0.15mm; border-top: 2px solid #ddd; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;">
+                            <strong t-if="o.partner_shipping_id == o.partner_invoice_id">Dirección de facturación y de envío:</strong>
+                            <strong t-if="o.partner_shipping_id != o.partner_invoice_id">Dirección de facturación:</strong>
+                            <div t-field="o.partner_invoice_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;, &quot;phone&quot;, &quot;fax&quot;], &quot;no_marker&quot;: true}"/>
+                            <p t-if="o.partner_id.vat">RUC: <span t-field="o.partner_id.ruc"/></p>
+                            <div t-if="o.partner_shipping_id != o.partner_invoice_id" class="mt8">
+                                <strong>Dirección de envío:</strong>
+                                <div t-field="o.partner_shipping_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;, &quot;phone&quot;, &quot;fax&quot;], &quot;no_marker&quot;: true}"/>
+                                <p t-if="o.partner_id.ruc">RUC: <span t-field="o.partner_id.ruc"/></p>
+                            </div>
+                        </div>
+                        <div class="col-xs-12" style="padding-left: 0.01mm; padding-top: 0.01mm; padding-bottom: 0.15mm; border-top: 2px solid #ddd; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;">
+                           <h4>
+                               <center>
+                               <span t-if="o.state not in ['draft','sent']">PEDIDO N° </span>
+                               <span t-if="o.state in ['draft','sent']">PRESUPUESTO N° </span>
+                               <span t-field="o.name"/>
+                               </center>
+                           </h4>
+                         </div>
+                         <div t-if="o.date_order" class="col-xs-12" style="padding-left: 0.01mm; padding-top: 0.01mm; padding-bottom: 0.15mm; border-top: 2px solid #ddd; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;">
+                               <strong t-if="o.state not in ['draft','sent']">Fecha de Pedido:</strong>
+                               <strong t-if="o.state in ['draft','sent']">Fecha de Presupuesto:</strong>
+                               <p t-field="o.date_order"/>
+                           </div>
+                           <div t-if="o.user_id.name" class="col-xs-12" style="padding-left: 0.01mm; padding-top: 0.01mm; padding-bottom: 0.15mm; border-top: 2px solid #ddd; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;">
+                               <strong>Usuario:</strong>
+                               <p t-field="o.user_id.name"/>
+                           </div>
+
+                        <!-- <div class="divisoria1"> </div> -->
+                        <table style="border-collapse: collapse; width: 100%;" class="product">
+
+                                <tr>
+                                  <th style="padding: 0.2cm; width:10%; border-collapse: collapse; border-top: 2px solid #ddd; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;" class="text-center">Cant.</th>
+                                  <th style="padding: 0.2cm; width:55%; border-collapse: collapse; border-top: 2px solid #ddd; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;" class="text-center">Descripción</th>
+                                  <th style="padding: 0.2cm; width:15%; border-collapse: collapse; border-top: 2px solid #ddd; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;" class="text-center">Precio Unit.</th>
+                                  <th style="padding: 0.2cm; width:20%; border-collapse: collapse; border-top: 2px solid #ddd; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;" class="text-center">Sub Total</th>
+                                </tr>
+                       </table>
+
+                       <!-- <div style="height: 7.5cm;border-top: 2px solid #ddd; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;"> -->
+                            <table style="border-collapse: collapse; width: 100%; border-top: 2px solid #ddd; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;">
+                                  <tr t-foreach="o.order_line" t-as="l">
+                                    <td style="text-align: center; padding: 0.1cm; width: 10%; border-collapse: collapse; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;"><span t-esc="'{0:,.0f}'.format(l.product_uom_qty)"/></td>
+                                    <td style="text-align: left; padding: 0.1cm; width:55%; border-collapse: collapse; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;"><span t-field="l.product_id.name"/></td>
+                                    <td style="text-align: right; padding: 0.1cm; width:15%; border-collapse: collapse; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;"><span t-esc="'{0:,.0f}'.format(l.price_unit)"/></td>
+                                    <td style="text-align: right; padding: 0.1cm; width:20%; border-collapse: collapse; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; border-left: 2px solid #ddd; border-right: 2px solid #ddd;"><span t-esc="'{0:,.0f}'.format((l.product_uom_qty * l.price_unit))"/></td>
+                                  </tr>
+                                  <!-- Inserta más filas aquí -->
+                           </table>
+                      <!-- </div> -->
+
+                        <div class="divisoria"> </div>
+                        <div class="row">
+                                 <div class="col-xs-4 pull-right">
+                                     <table class="table table-condensed">
+                                         <tr class="border-black">
+                                             <td><strong>Sub Total:</strong></td>
+                                             <td class="text-right">
+                                                 <span t-esc="'{0:,.0f}'.format(o.amount_total)"/>
+                                             </td>
+                                         </tr>
+                                         <tr>
+                                             <td>Total IVA:</td>
+                                             <td class="text-right">
+                                                 <span t-esc="'{0:,.0f}'.format(o.amount_tax)"/>
+                                             </td>
+                                         </tr>
+                                         <tr class="border-black">
+                                             <td><strong>Total</strong></td>
+                                             <td class="text-right">
+                                                  <span t-esc="'{0:,.0f}'.format(o.amount_total)"/>
+                                             </td>
+                                         </tr>
+                                     </table>
+                                 </div>
+                             </div>
+
+
+                        <div class="divisoria"> </div>
+                        <p t-field="o.note"/>
+                         <p t-if="o.payment_term.note">
+                             <strong>Payment Term:</strong>
+                             <span t-field="o.payment_term.note"/>
+                         </p>
+                    </div>
+                </t>
+            </div>
+        </t>
+      </t>
+    </template>
+</data>
+</openerp>

BIN
static/description/icon.png


BIN
static/img/kava.png


+ 3 - 0
static/src/css/style.css

@@ -0,0 +1,3 @@
+.print_workorder{
+    height: 35px;
+}