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

Módulo para impresión de factura Tag

sebas 3 éve
commit
17d5e145be

+ 20 - 0
__init__.py

@@ -0,0 +1,20 @@
+# -*- 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 factura_venta_tag, res_currency

BIN
__init__.pyc


+ 41 - 0
__openerp__.py

@@ -0,0 +1,41 @@
+# -*- 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': 'Factura Venta Legal tag',
+    'version': '0.1',
+    'category': 'Product',
+    'description': """
+Factura Venta Legal tag
+==========================
+
+Formato para imprimir la factura legal de tag
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': 'http://www.eiru.com',
+    'depends': ['base','account'],
+    'data': [
+        'factura_venta_tag.xml',
+        'res_currency_view.xml'
+    ],
+    'installable': True,
+}

+ 41 - 0
account_invoice.py

@@ -0,0 +1,41 @@
+# -*- 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 openerp import models, fields, api
+
+# class account_invoice(models.Model):
+#     _inherit = 'account.invoice'
+#     _name = 'account.invoice'
+#
+#     contado = fields.Boolean('Contado')
+#     credito = fields.Boolean('Crédito')
+#
+#     _defaults = {
+#         'contado': True
+#     }
+#
+#     @api.one
+#     @api.onchange('credito')
+#     def cambiar_estado_credito(self):
+#         self.contado = not self.credito
+#
+#     @api.one
+#     @api.onchange('contado')
+#     def cambiar_estado_contado(self):
+#         self.credito = not self.contado

BIN
account_invoice.pyc


+ 17 - 0
account_invoice_view.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- <openerp>
+    <data>
+        <record id="account_invoice_cred_cont" model="ir.ui.view">
+            <field name="name">account.invoice.cred.cont</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_form" />
+            <field name="arch" type="xml">
+                <field name="fiscal_position" position="after">
+                        <field name="contado"/>
+                        <field name="credito"/>
+                </field>
+            </field>
+        </record>
+    </data>
+</openerp> -->

+ 30 - 0
factura_venta_tag.py

@@ -0,0 +1,30 @@
+from openerp import api, models
+import datetime
+from num2words import num2words
+
+class report_factura_tag(models.AbstractModel):
+    _name = 'report.factura_venta_tag.report_factura_tag'
+
+    @api.multi
+    def render_html(self, data=None):
+        report_obj = self.env['report']
+        report = report_obj._get_report_from_name('factura_venta_tag.report_factura_tag')
+        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('factura_venta_tag.report_factura_tag', 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
factura_venta_tag.pyc


+ 536 - 0
factura_venta_tag.xml

@@ -0,0 +1,536 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+     <report id="factura_venta_tag"
+        model="account.invoice"
+        string="Factura Legal"
+        report_type="qweb-html"
+        name="factura_venta_tag.report_factura_tag"
+        file="factura_venta_tag.report_factura_tag"
+     />
+
+    <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_factura_tag">
+        <t t-call="report.html_container">
+            <t t-call="report.external_layout">
+			    <t t-foreach="[1,2,3]" t-as="i">
+                <div class="page">
+                    <style type="text/css">
+                        body{
+                            font-size: 2.5mm;
+                            font-family: Arial, Helvetica, sans-serif;
+                        }
+                        div{
+                            padding: 0px;
+                        }
+                        .pagina{
+                            width:19.3cm;
+                        }
+                        .logo{
+                            height: 0.78cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .fecha_emision_data{
+                            width: 9.1cm;
+                            font-size: 2.5mm;
+                            padding-left: 2.86cm;
+                            float: left;
+
+                        }
+                        .ruc_data1{
+                             width: 3.0cm;
+                             font-size: 2.5mm;
+                             font-family: Arial, Helvetica, sans-serif;
+                             float: left;
+                             padding-left: 0.3cm;
+
+                         }
+                        .contado_x{
+                            width: 6.6cm;
+                            float: right;
+                            font-size: 2.4mm;
+                            padding-left: 0.9mm;
+
+                        }
+                        .linea2{
+                            position: relative;
+                            top: -0.12cm;
+                            min-height: 0.4cm;
+                         }
+                        .razon_data{
+                            width: 13.7cm;
+                            float: left;
+                            font-size: 2.4mm;
+                            padding-left: 5.7cm;
+
+                        }
+                        .ruc_data{
+                             width: 6.5cm;
+                             font-size: 2.4mm;
+                             float: right;
+                             padding-left: 0.1cm;
+
+                         }
+
+                        .linea3{
+                            position: relative;
+                            top: -0.12cm;
+                            min-height: 0.4cm;
+                         }
+                        .direccion_data{
+                            width: 11.0cm;
+                            font-size: 2.4mm;
+                            font-family: Arial, Helvetica, sans-serif;
+                            float: left;
+                            padding-left: 4.1cm;
+                        }
+                        .nota_remision_data{
+                            width: 5.3cm;
+                            float: left;
+                            padding-left: 2.5cm;
+
+                        }
+                        .linea4{
+                            position: relative;
+                            top: -0.12cm;
+                            min-height: 0.4cm;
+                         }
+                        .telefono_data{
+                            width: 7.8cm;
+                            font-size: 2.3mm;
+                            font-family: Arial, Helvetica, sans-serif;
+                            float: right;
+                            padding-left: 3.8cm;
+                        }
+                        .art-col11{
+                            padding-left: 0.2mm;
+                            width:1.7cm;
+                            text-align: left;
+                        }
+                        .art-col13{
+                            padding-left: 1.0cm;
+                            width:9.3cm;
+                            text-align: center;
+                        }
+                        .art-col14{
+                            width:1.8cm;
+                            text-align: right;
+                        }
+                        .art-col15{
+                            width:2.2cm;
+                            padding-left: 0.3cm;
+                            text-align: left;
+                        }
+                        .art-col16{
+                            width:1.0cm;
+                            text-align: right;
+                        }
+                        .art-col17{
+                            width:2.0cm;
+                            text-align: right;
+                        }
+                        .cab-articulos{
+                            height: 0.85cm;
+                            clear: both;
+                        }
+                        .articulos{
+                            height: 3.355cm;
+                        }
+                        .art-col2{
+						                padding-left: 0.2mm;
+                            width:1.8cm;
+                            font-size: 2.0mm;
+                            text-align: center;
+                            vertical-align: top;
+                            min-height: 0.6cm;
+                        }
+                        .art-col3{
+                            padding-left: 1.0cm;
+                            font-size: 2.0mm;
+                            width:2.0cm;
+                            text-align: center;
+                            vertical-align: top;
+                            min-height: 0.6cm;
+                        }
+                        .art-col4{
+                            width:6.9cm;
+                            font-size: 2.0mm;
+                            padding-left: 0.2mm;
+                            text-align: left;
+                            vertical-align: top;
+                            min-height: 0.6cm;
+
+                        }
+                        .art-col5{
+                            width:1.68cm;
+                            font-size: 2.0mm;
+                            text-align: right;
+                            vertical-align: top;
+                            min-height: 0.6cm;
+
+                        }
+                        .art-col8{
+                            width:1.7cm;
+                            font-size: 2.0mm;
+                            text-align: right;
+                            vertical-align: top;
+                            min-height: 0.6cm;
+
+                        }
+                        .art-col6{
+                            width:2.0cm;
+                            font-size: 2.0mm;
+                            vertical-align: top;
+                            text-align: right;
+                            min-height: 0.6cm;
+
+                        }
+                        .art-col7{
+                            width:2.3cm;
+                            font-size: 2.0mm;
+                            text-align: right;
+                            vertical-align: top;
+                            min-height: 0.6cm;
+
+                        }
+                        .tab-articulos{
+                            height: 0.87cm;
+                            clear: both;
+                        }
+                        .art-col31{
+                            padding-left: 0.2mm;
+                            width:1.0cm;
+                            text-align: left;
+                        }
+                        .art-col33{
+                            padding-left: 1.0cm;
+                            width:7.7cm;
+                            text-align: left;
+                        }
+                        .art-col34{
+                            width:1.4m;
+                            text-align: right;
+                        }
+                        .art-col35{
+                            width:1.2cm;
+                            text-align: left;
+                        }
+                        .art-col36{
+                            width:3.2cm;
+                            text-align: right;
+                        }
+
+                        .tab-articulos4{
+                            height: 0.0cm;
+                            padding-left: 0.0cm;
+                            clear: both;
+                        }
+                        .art-col41{
+                            padding-left: 0.2mm;
+                            width:1.7cm;
+                            text-align: left;
+                        }
+                        .art-col43{
+                            padding-left: 1.0cm;
+                            width:9.3cm;
+                            text-align: center;
+                        }
+                        .art-col44{
+                            width:1.8cm;
+                            text-align: right;
+                        }
+                        .art-col45{
+                            width:1.7cm;
+                            padding-left: 0.3cm;
+                            text-align: left;
+                        }
+                        .art-col46{
+                            width:2.0cm;
+                            text-align: center;
+                        }
+                        .art-col47{
+                            width:2.0cm;
+                            text-align: right;
+                        }
+						            .logo1{
+                            height: 2.83cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .logo2{
+                            height: 2.85cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .logo3{
+                            height: 4.69cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .subtotal_data{
+                            width: 6cm;
+                            float: left;
+                            padding-top: 0.002cm;
+                            padding-left: 2.3cm;
+                            min-height: 0.2cm;
+                        }
+                        .subtotal_excentas{
+                            width: 1.8cm;
+                            float: left;
+                            text-align: right;
+							              padding-left: 7.9cm;
+                            padding-top: 0.7cm;
+                            min-height: 0.2cm;
+                        }
+                        .subtotal_5{
+                            width: 1.8cm;
+                            float: left;
+							              padding-left: 1cm;
+                            text-align: right;
+                            padding-top: 0.7cm;
+                            min-height: 0.2cm;
+                        }
+                        .subtotal_10{
+                            width: 2.8cm;
+                            float: left;
+							              padding-left: 0.8cm;
+                            text-align: right;
+                            padding-top: 0.7cm;
+                            min-height: 0.2cm;
+                        }
+                        .total_pagar_data{
+                            width: 6.4cm;
+                            float: left;
+                            padding-top: 0.01mm;
+                            padding-left: 3.8cm;
+                            min-height: 0.5cm;
+                        }
+                        .total_pagar{
+                            width: 2.3cm;
+                            float: right;
+                            padding-top: 0.01mm;
+                            padding-left: 0.8cm;
+                            min-height: 0.5cm;
+                        }
+
+                        .iva_5_data{
+                            width: 5cm;
+                            float: left;
+                            padding-top: 0.04mm;
+                            padding-left: 1.7cm;
+                            font-size: 2.4mm;
+                            min-height: 0.5cm;
+                        }
+                        .iva_10_data{
+                            width: 5.2cm;
+                            float: left;
+                            padding-left: 1.4cm;
+                            font-size: 2.4mm;
+                            padding-top: 0.04mm;
+                            min-height: 0.5cm;
+                        }
+                        .iva_total_data{
+                            width: 5.8cm;
+                            float: left;
+                            font-size: 2.4mm;
+                            padding-left: 1.8cm;
+                            padding-top: 0.04mm;
+                            min-height: 0.5cm;
+                        }
+
+                    </style>
+                    <t t-foreach="docs" t-as="o">
+                        <div class="pagina">
+                            <div class="logo"> </div>
+                            <table class="tab-articulos2">
+                              <td class="art-col11"> </td>
+                              <td class="art-col13">
+
+                                  <span t-field="o.date_invoice" t-field-options='{"format": "dd MMM yyyy"}'/>
+
+                              </td>
+                              <td class="art-col14">
+                                 <t t-if="o.credito == True">
+                                     <b>Vencimiento: </b>
+                                 </t>
+                              </td>
+                              <td class="art-col15">
+                                <t t-if="o.credito == True">
+                                   <span t-field="o.date_due" t-field-options='{"format": "dd/MM/yyyy"}'/>
+                                </t>
+                              </td>
+
+                              <td class="art-col16">
+                                <div class="contado_x">
+                                    <t t-if="o.contado == True">Contado</t>
+                                    <t t-if="o.contado == False">Crédito</t>
+                                </div>
+                              </td>
+                              <td class="art-col17">
+
+                              </td>
+                            </table>
+
+                            <table class="tab-articulos2">
+                                <td class="art-col11"> </td>
+                                <td class="art-col13">
+                                    <t t-f="o.partner_id.name"><span t-field="o.partner_id.name"/></t>
+                                    <t t-f="not o.partner_id.name">-</t>
+                                </td>
+                                <td class="art-col14"> </td>
+                                <td class="art-col15"> </td>
+                                <td class="art-col16">
+                                  <div class="ruc_data">
+                                      <span t-field= "o.partner_id.ruc"/>
+                                  </div>
+                                </td>
+                                <td class="art-col17">
+                                </td>
+
+                            </table>
+
+                            <table class="tab-articulos2">
+                                <td class="art-col11"> </td>
+                                <td class="art-col13">
+                                  <t t-f="o.partner_id.street"><span t-field="o.partner_id.street"/></t>
+                                  <t t-f="not o.partner_id.street">-</t>
+                                </td>
+                                <td class="art-col14"> </td>
+                                <td class="art-col15"> </td>
+                                <td class="art-col16">
+
+                                </td>
+                                <td class="art-col17">
+                                </td>
+
+                            </table>
+
+                            <table class="tab-articulos2">
+                                <td class="art-col11"> </td>
+                                <td class="art-col13">
+                                  <t t-f="o.partner_id.phone"><span t-field="o.partner_id.mobile"/>  <span t-field="o.partner_id.phone"/></t>
+                                  <t t-f="not o.partner_id.phone">-</t>
+                                </td>
+                                <td class="art-col14"> </td>
+                                <td class="art-col15"> </td>
+                                <td class="art-col16">
+
+                                </td>
+                                <td class="art-col17">
+                                </td>
+
+                            </table>
+
+
+                            <div class="cab-articulos"> </div>
+                            <div class="articulos">
+
+                               <table class="tab-articulos">
+                                      <!-- <div style="border:0.1px white;"></div> -->
+                                    <tr t-foreach="o.invoice_line" t-as="l">
+                                        <td class="art-col2"><span t-field="l.product_id.id"/></td>
+                                        <td class="art-col3"><span t-esc="'%.0f'%l.quantity"/></td>
+                                        <td class="art-col4"><span t-field="l.name"/></td>
+                                        <td class="art-col5"><span t-esc="'{0:,.0f}'.format(l.price_unit)"/></td>
+                                        <td class="art-col8"> </td>
+                                        <td class="art-col6"> </td>
+                                        <td class="art-col7"><span t-esc="'{0:,.0f}'.format((l.quantity * l.price_unit))"/></td>
+                                   </tr>
+                                </table>
+                            </div>
+
+                             <div class="subtotal_data"> </div>
+                             <div class="subtotal_excentas"> </div>
+                             <div class="subtotal_5"> </div>
+                             <td style="font-size:7.0px;">
+                                <t t-if="o.currency_id.id == 166">
+                                  <div class="subtotal_10"><span t-esc="'{0:,.0f}'.format(o.amount_total)"/></div>
+                                </t>
+                                <t t-if="o.currency_id.id != 166">
+                                    <div class="subtotal_10"><span t-esc="'{0:,.2f}'.format(o.amount_total)"/></div>
+                                </t>
+                            </td>
+                            <div class="total_pagar_data"></div>
+
+                            <tr>
+                               <table class="tab-articulos2">
+                                 <td class="art-col33">
+                                 </td>
+                                  <td class="art-col34">
+                                  </td>
+                                  <td class="art-col35">
+
+                                  </td>
+                                  <td class="art-col36">
+                                    <t t-if="o.currency_id.id == 166">
+                                        <span t-esc="'{0:,.0f}'.format(o.amount_total)"/>
+                                    </t>
+                                    <t t-if="o.currency_id.id != 166">
+                                        <span t-esc="'{0:,.2f}'.format(o.amount_total)"/>
+                                    </t>
+                                  </td>
+
+                                </table>
+                              </tr>
+
+
+                              <table class="tab-articulos4">
+                                 <td class="art-col41">
+                                 </td>
+                                 <td class="art-col43">
+                                                                <t t-if="o.currency_id.id == 166">
+                                                                    <div><span t-esc="convertir(o.amount_total,o.currency_id.en_letras)"/></div>
+                                                                </t>
+                                                                <t t-if="o.currency_id.id != 166">
+                                                                     <div><span t-esc="convertir(o.amount_total,o.currency_id.en_letras)"/></div>
+                                                                 </t>
+                                </td>
+                                <td class="art-col44"> </td>
+                                <td class="art-col45">
+
+                                </td>
+                                <td class="art-col46">
+                                      <span t-esc="'{0:,.0f}'.format(o.amount_tax)"/>
+                                </td>
+                                                              <td class="art-col47">
+                                                                <span t-esc="'{0:,.0f}'.format(o.amount_tax)"/>
+                                                              </td>
+
+                              </table>
+
+
+                        </div>
+                        <t t-if="i == 1">
+                            <div class="logo1"> </div>
+                        </t>
+                        <t t-if="i == 2">
+                            <div class="logo2"> </div>
+                        </t>
+                        <!-- <t t-if="i == 3">
+                            <div class="logo3"> </div>
+                        </t> -->
+
+                    </t>
+                </div>
+				</t>
+            </t>
+        </t>
+    </template>
+
+</data>
+</openerp>

+ 26 - 0
res_currency.py

@@ -0,0 +1,26 @@
+# -*- 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 openerp import models, fields
+
+class res_currency(models.Model):
+    _inherit = 'res.currency'
+    _name = 'res.currency'
+
+    en_letras = fields.Char('En letras')

BIN
res_currency.pyc


+ 16 - 0
res_currency_view.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<openerp>
+    <data>
+        <record id="res_currency_en_letras" model="ir.ui.view">
+            <field name="name">res.currency.en.letras</field>
+            <field name="model">res.currency</field>
+            <field name="inherit_id" ref="base.view_currency_form" />
+            <field name="arch" type="xml">
+                <field name="symbol" position="after">
+                    <field name="en_letras"/>
+                </field>
+            </field>
+        </record>
+    </data>
+</openerp>

BIN
static/description/icon.png