Преглед на файлове

Ajuste impresión factura Medicalart

sebas преди 3 години
ревизия
36effacc98

+ 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 account_invoice, res_currency, factura_venta_medicalart

BIN
__init__.pyc


+ 43 - 0
__openerp__.py

@@ -0,0 +1,43 @@
+# -*- 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 with enable features management for products #
+###################################################################################
+{
+    'name': 'Factura de Venta medicalart',
+    'version': '0.1',
+    'category': 'Product',
+    'description': """
+Factura Venta Legal medicalart
+
+
+Formato para imprimir la factura legal de medicalart
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': 'http://www.eiru.com.py',
+    'depends': ['base','account','sale'],
+    'data': [
+	    'factura_venta_medicalart.xml',
+        'factura_ventainvoice_medicalart.xml',
+        'account_invoice_view.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>

+ 29 - 0
factura_venta_medicalart.py

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


+ 372 - 0
factura_venta_medicalart.xml

@@ -0,0 +1,372 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+     <report id="factura_venta_medicalart"
+        model="account.invoice"
+        string="Factura Legal"
+        report_type="qweb-html"
+        name="factura_venta_medicalart.report_factura_medicalart"
+        file="factura_venta_medicalart.report_factura_medicalart"
+     />
+
+    <template id="report_factura_medicalart">
+        <t t-call="report.html_container">
+            <t t-foreach="[1]" t-as="i">
+                <div class="page">
+                    <style type="text/css">
+                        body{
+                            font-size: 3.0mm;
+
+                            font-family: Arial, Helvetica, sans-serif;
+                        }
+                        div{
+                            padding: 0px;
+                        }
+                        .pagina{
+                            width:19.3cm;
+                        }
+                        .logo{
+                            height: 4.2cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .logo1{
+                            height: 4.7cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .fecha_emision_data{
+                            width: 12.9cm;
+                            padding-left:2.8cm;
+                            float: left;
+                            min-height: 0.48cm;
+                        }
+                        .contado_x{
+                            width: 1cm;
+                            float: left;
+                            padding-left: 2.9cm;
+                            min-height: 0.7cm;
+                        }
+                        .credito_x{
+                            width: 1cm;
+                            float: left;
+                            padding-left: 0.9cm;
+                            min-height: 0.7cm;
+                        }
+
+                        .razon_data{
+                            width: 11.7cm;
+                            float: left;
+                            padding-left: 3.8cm;
+                            min-height: 0.49cm;
+                        }
+                        .ruc_data{
+                            width: 5cm;
+                            float: left;
+                            padding-left: 2.8cm;
+                            min-height: 0.47cm;
+                        }
+                        .direccion_data{
+                            width: 13.5cm;
+                            float: left;
+                            padding-left:2.7cm;
+                            min-height: 0.45cm;
+                        }
+                        .telefono_data{
+                            width: 3.5cm;
+                            float: right;
+                            padding-left: 0.1mm;
+                            min-height: 0.45cm;
+                        }
+                        .nota_remision_data{
+                            width: 13cm;
+                            float: left;
+                            padding-left: 2.8cm;
+                            min-height: 0cm;
+                        }
+                        .dias_credito{
+                            width: 5cm;
+                            float: left;
+                            padding-left: 0.8cm;
+                            min-height: 0cm;
+                        }
+                        .cab-articulos{
+                            height: 1.3cm;
+                            clear: both;
+                        }
+                        .divisoria1{
+                            height: 2.1cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+
+                        .borderless td, .borderless th {
+                            border: none !important;
+                        }
+                        .table-condensed>tbody>tr>td {
+                            padding: 1px !important;
+                        }
+                        .table-super-condensed>tbody>tr>td {
+                            padding: 5px !important;
+                        }
+                        .table-condensed2>tbody>tr>td {
+                            padding: 2.5px !important;
+                        }
+
+                    </style>
+                    <t t-foreach="docs" t-as="o">
+                        <div class="pagina">
+                            <div class="logo"> </div>
+                            <tr>
+                                <div class="fecha_emision_data"><span t-field="o.date_invoice" t-field-options='{"format": "dd MMMM yyyy"}'/></div>
+                                <div class="contado_x">
+                                    <t t-if="o.contado == True">x</t>
+                                </div>
+                                <div class="contado_x">
+                                    <t t-if="o.credito == True">x</t>
+                                </div>
+                            </tr>
+
+                            <tr>
+                                <div class="razon_data"><span t-field="o.partner_id.name"/></div>
+                                <div class="ruc_data"><span t-field="o.partner_id.ruc"/></div>
+                            </tr>
+
+                            <tr>
+                                <div class="direccion_data">
+                                    <t t-f="o.partner_id.street"><span t-field="o.partner_id.street"/> <span t-field="o.partner_id.street2"/></t>
+                                    <t t-f="not o.partner_id.street"> </t>
+                                </div>
+                                <!-- <div class="telefono_data"><span t-field="o.partner_id.mobile"/></div> -->
+                            </tr>
+
+                            <tr>
+                                <div class="nota_remision_data"></div>
+                                <div class="dias_credito"></div>
+                            </tr>
+
+                            <div class="cab-articulos"> </div>
+                            <div style="height:6.2cm;">
+                                <div style="font-family: Arial;">
+                                    <table class="table borderless table-condensed">
+                                        <t t-set="valor_exentas" t-value="0"/>
+                                        <t t-set="valor_5" t-value="0"/>
+                                        <t t-set="valor_10" t-value="0"/>
+                                        <tbody>
+                                            <tr t-foreach="o.invoice_line" t-as="l">
+                                                <!-- CANTIDAD -->
+                                                <td style="font-size:9px;font-family: Arial;width:1.2cm;overflow: auto; text-align: center;">
+                                                    <span t-esc="'%.0f'%l.quantity"/>
+                                                </td>
+                                                <!-- CODIGO DE PRODUCTO -->
+                                                <td style="font-size:9px;font-family: Arial;width:2.0cm;overflow: auto; text-align: left;">
+                                                    <span t-field="l.product_id.default_code"/>
+                                                </td>
+                                                <!-- NOMBRE DEL PRODUCTO -->
+                                                <td style="font-size:9px;font-family: Arial;width:7.1cm;overflow: auto;">
+                                                    <span t-field="l.name"/>
+                                                </td>
+                                                <!-- PRECIO UNITARIO -->
+                                                <td style="font-size:9px;font-family: Arial;width:1.8cm;overflow: auto; text-align: right;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <span t-esc="'{0:,.0f}'.format(l.price_unit)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <span t-esc="'{0:,.2f}'.format(l.price_unit)"/>
+                                                    </t>
+                                                </td>
+                                                <!-- EXENTAS -->
+                                                <td style="font-size:9px;font-family: Arial;width:2.0cm;overflow: auto; text-align: right;">
+                                                    <span t-if="'IVA 5% Venta' not in [ilt.name for ilt in l.invoice_line_tax_id] and 'IVA 10% Venta' not in [ilt.name for ilt in l.invoice_line_tax_id]">
+                                                        <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>
+                                                        <t t-set="valor_exentas" t-value="valor_exentas+(l.quantity * l.price_unit)"/>
+                                                    </span>
+                                                </td>
+
+                                                <!-- IVA 5% -->
+                                                <td style="font-size:9px;font-family: Arial;width:2cm;overflow: auto; text-align: right;">
+                                                    <span t-if="'IVA 5% Venta' in [ilt.name for ilt in l.invoice_line_tax_id] and 'IVA 10% Venta' not in [ilt.name for ilt in l.invoice_line_tax_id]">
+                                                        <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>
+                                                        <t t-set="valor_5" t-value="valor_5+(l.quantity * l.price_unit)"/>
+                                                    </span>
+                                                </td>
+
+                                                <!-- IVA 10% -->
+                                                <td style="font-size:9px;font-family: Arial;width:2.3cm;overflow: auto; text-align: right;">
+                                                    <span t-if="'IVA 10% Venta' in [ilt.name for ilt in l.invoice_line_tax_id]">
+                                                        <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>
+                                                        <t t-set="valor_10" t-value="valor_10+(l.quantity * l.price_unit)"/>
+                                                    </span>
+                                                </td>
+                                            </tr>
+                                        </tbody>
+                                    </table>
+                                </div>
+                            </div>
+                            <div style="height:1.9cm;padding-left:1.7cm;">
+                                    <t t-set="total_exentas" t-value="0"/>
+                                    <t t-set="total_5" t-value="0"/>
+                                    <t t-set="total_10" t-value="0"/>
+                                    <t t-set="iva_5" t-value="0"/>
+                                    <t t-set="iva_10" t-value="0"/>
+                                    <t t-set="iva_exentas" t-value="0"/>
+                                    <table class="table borderless table-condensed2">
+                                        <tbody>
+
+                                            <tr>
+                                                <td style="font-size:10px;font-family: Arial;width:1.2cm;overflow: auto; text-align: center;"></td>
+                                                <td style="font-size:10px;font-family: Arial;width:2.0cm;overflow: auto; text-align: center;"></td>
+                                                <td style="font-size:10px;font-family: Arial;width:7.1cm;overflow: auto; text-align: center;"></td>
+                                                <td style="font-size:10px;font-family: Arial;width:2cm;overflow: auto; text-align: center;"></td>
+                                                <td style="font-size:10px;font-family: Arial;width:2.0cm;overflow: auto; text-align: right;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <span t-esc="'{0:,.0f}'.format(valor_exentas)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <span t-esc="'{0:,.2f}'.format(valor_exentas)"/>
+                                                    </t>
+                                                    <t t-set="iva_exentas" t-value="valor_exentas"/>
+                                                </td>
+                                                <td style="font-size:10px;font-family: Arial;width:2.1cm;overflow: auto; text-align: right;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <span t-esc="'{0:,.0f}'.format(valor_5)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <span t-esc="'{0:,.2f}'.format(valor_5)"/>
+                                                    </t>
+                                                    <t t-set="iva_5" t-value="valor_5/21" />
+                                                </td>
+                                                <td style="font-size:10px;font-family: Arial;width:2.3cm;overflow: auto; text-align: right;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <span t-esc="'{0:,.0f}'.format(valor_10)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <span t-esc="'{0:,.2f}'.format(valor_10)"/>
+                                                    </t>
+                                                    <t t-set="iva_10" t-value="(valor_10)/11" />
+                                                </td>
+                                            </tr>
+                                            <!-- <t t-if="i == 2">
+                                                <div class="divisoria2"> </div>
+                                            </t> -->
+                                            <!-- LINEA TOTAL EN LETRAS Y TOTAL GENERAL -->
+                                            <tr>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.2cm;overflow: auto; text-align: center;"></td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.5cm;overflow: auto; text-align: center;"></td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:7cm;overflow: auto; text-align: left;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <div>Gs <span t-esc="convertir('%.0f'%o.amount_total,o.currency_id.en_letras)"/></div>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <div>Dólares <span t-esc="convertir('%.0f'%o.amount_total,o.currency_id.en_letras)"/></div>
+                                                    </t>
+                                                </td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2cm;overflow: auto; text-align: center;"></td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2cm;overflow: auto; text-align: right;"></td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.2cm;overflow: auto; text-align: right;">
+
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.5cm;overflow: auto; text-align: right;">
+                                                    <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>
+                                                </td>
+                                            </tr>
+                                            <!-- TOTAL DE IVA -->
+                                            <div class="divisoria1"> </div>
+
+
+                                            <tr>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.2cm;overflow: auto; text-align: center;"></td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.5cm;overflow: auto; text-align: center;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <div>
+                                                            <t t-if="iva_5 != 0">
+                                                                <span t-esc="'{0:,.0f}'.format(iva_5)"/>
+                                                            </t>
+                                                        </div>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <div>
+                                                            <t t-if="iva_5 != 0">
+                                                                <span t-esc="'{0:,.0f}'.format(iva_5)"/>
+                                                            </t>
+                                                        </div>
+                                                    </t>
+                                                </td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:7cm;overflow: auto; text-align: left;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <div>
+                                                            <t t-if="iva_10 != 0">
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                <span t-esc="'{0:,.0f}'.format(iva_10)"/>
+                                                            </t>
+                                                        </div>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <div>
+                                                            <t t-if="iva_10 != 0">
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                <span t-esc="'{0:,.0f}'.format(iva_10)"/>
+                                                            </t>
+
+                                                        </div>
+                                                    </t>
+                                                </td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2cm;overflow: auto; text-align: left;">
+                                                    <t t-if="o.currency_id.id == 166">
+
+                                                        <span t-esc="'{0:,.0f}'.format(iva_5+iva_10)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+
+                                                        <span t-esc="'{0:,.0f}'.format(iva_5+iva_10)"/>
+                                                    </t>
+                                                </td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.0cm;overflow: auto; text-align: right;">
+
+                                                </td>
+
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.2cm;overflow: auto; text-align: center;">
+                                                </td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.5cm;overflow: auto; text-align: right;">
+                                                </td>
+                                            </tr>
+                                        </tbody>
+                                    </table>
+                            </div>
+                            <div class="logo1"> </div>
+                        </div>
+
+                    </t>
+
+                </div>
+            </t>
+        </t>
+    </template>
+</data>
+</openerp>

+ 29 - 0
factura_ventainvoice_medicalart.py

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


+ 373 - 0
factura_ventainvoice_medicalart.xml

@@ -0,0 +1,373 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+     <report id="factura_ventainvoice_medicalart"
+        model="sale.order"
+        string="Factura Legal"
+        report_type="qweb-html"
+        name="factura_venta_medicalart.report_facturainvoice_medicalart"
+        file="factura_venta_medicalart.report_facturainvoice_medicalart"
+     />
+
+    <template id="report_facturainvoice_medicalart">
+        <t t-call="report.html_container">
+            <t t-foreach="[1]" t-as="i">
+                <div class="page">
+                    <style type="text/css">
+                        body{
+                            font-size: 3mm;
+
+                            font-family: Arial, Helvetica, sans-serif;
+                        }
+                        div{
+                            padding: 0px;
+                        }
+                        .pagina{
+                            width:19.3cm;
+                        }
+                        .logo{
+                            height: 4.2cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .logo1{
+                            height: 4.7cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+                        .fecha_emision_data{
+                            width: 12.9cm;
+                            padding-left:2.8cm;
+                            float: left;
+                            min-height: 0.48cm;
+                        }
+                        .contado_x{
+                            width: 1cm;
+                            float: left;
+                            padding-left: 2.9cm;
+                            min-height: 0.7cm;
+                        }
+                        .credito_x{
+                            width: 1cm;
+                            float: left;
+                            padding-left: 0.9cm;
+                            min-height: 0.7cm;
+                        }
+                        .razon_data{
+                            width: 11.7cm;
+                            float: left;
+                            padding-left: 3.8cm;
+                            min-height: 0.49cm;
+                        }
+                        .ruc_data{
+                            width: 5cm;
+                            float: left;
+                            padding-left: 2.8cm;
+                            min-height: 0.47cm;
+                        }
+                        .direccion_data{
+                            width: 13.5cm;
+                            float: left;
+                            padding-left:2.7cm;
+                            min-height: 0.45cm;
+                        }
+                        .telefono_data{
+                            width: 3.5cm;
+                            float: right;
+                            padding-left: 0.1mm;
+                            min-height: 0.45cm;
+                        }
+                        .nota_remision_data{
+                            width: 13cm;
+                            float: left;
+                            padding-left: 2.8cm;
+                            min-height: 0cm;
+                        }
+                        .dias_credito{
+                            width: 5cm;
+                            float: left;
+                            padding-left: 0.8cm;
+                            min-height: 0cm;
+                        }
+                        .cab-articulos{
+                            height: 1.3cm;
+                            clear: both;
+                        }
+                        .divisoria1{
+                            height: 2.1cm;
+                            width: 100%;
+                            top: 0px;
+                        }
+
+                        .borderless td, .borderless th {
+                            border: none !important;
+                        }
+                        .table-condensed>tbody>tr>td {
+                            padding: 1px !important;
+                        }
+                        .table-super-condensed>tbody>tr>td {
+                            padding: 5px !important;
+                        }
+                        .table-condensed2>tbody>tr>td {
+                            padding: 2.5px !important;
+                        }
+
+                    </style>
+                    <t t-foreach="docs" t-as="o">
+                        <div class="pagina">
+                            <div class="logo"> </div>
+                            <tr>
+                                <div class="fecha_emision_data"><span t-field="o.date_order" t-field-options='{"format": "dd MMMM yyyy"}'/></div>
+                                <div class="contado_x">
+                                    <t t-if="o.contado == True">x</t>
+                                </div>
+                                <div class="contado_x">
+                                    <t t-if="o.credito == True">x</t>
+                                </div>
+
+                            </tr>
+
+                            <tr>
+                                <div class="razon_data"><span t-field="o.partner_id.name"/></div>
+                                <div class="ruc_data"><span t-field="o.partner_id.ruc"/></div>
+                            </tr>
+
+                            <tr>
+                                <div class="direccion_data">
+                                    <t t-f="o.partner_id.street"><span t-field="o.partner_id.street"/> <span t-field="o.partner_id.street2"/></t>
+                                    <t t-f="not o.partner_id.street"> </t>
+                                </div>
+                                <div class="telefono_data"><span t-field="o.partner_id.mobile"/></div>
+                            </tr>
+
+                            <tr>
+                                <div class="nota_remision_data"></div>
+                                <div class="dias_credito"></div>
+                            </tr>
+
+                            <div class="cab-articulos"> </div>
+                            <div style="height:6.2cm;">
+                                <div style="font-family: Arial;">
+                                    <table class="table borderless table-condensed">
+                                        <t t-set="valor_exentas" t-value="0"/>
+                                        <t t-set="valor_5" t-value="0"/>
+                                        <t t-set="valor_10" t-value="0"/>
+                                        <tbody>
+                                            <tr t-foreach="o.order_line" t-as="l">
+                                                <!-- CODIGO DE PRODUCTO -->
+                                                <td style="font-size:9px;font-family: Arial;width:1.2cm;overflow: auto; text-align: left;">
+                                                    <span t-field="l.product_id.default_code"/>
+                                                </td>
+                                                <!-- CANTIDAD -->
+                                                <td style="font-size:9px;font-family: Arial;width:2.0cm;overflow: auto; text-align: center;">
+                                                    <span t-esc="'%.0f'%l.product_uom_qty"/>
+                                                </td>
+
+                                                <!-- NOMBRE DEL PRODUCTO -->
+                                                <td style="font-size:9px;font-family: Arial;width:7.1cm;overflow: auto;">
+                                                    <span t-field="l.name"/>
+                                                </td>
+                                                <!-- PRECIO UNITARIO -->
+                                                <td style="font-size:9px;font-family: Arial;width:1.8cm;overflow: auto; text-align: right;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <span t-esc="'{0:,.0f}'.format(l.price_unit)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <span t-esc="'{0:,.2f}'.format(l.price_unit)"/>
+                                                    </t>
+                                                </td>
+                                                <!-- EXENTAS -->
+                                                <td style="font-size:9px;font-family: Arial;width:2.0cm;overflow: auto; text-align: right;">
+                                                    <span t-if="'IVA 5% Venta' not in [ilt.name for ilt in l.tax_id] and 'IVA 10% Venta' not in [ilt.name for ilt in l.tax_id]">
+                                                        <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>
+                                                        <t t-set="valor_exentas" t-value="valor_exentas+(l.product_uom_qty * l.price_unit)"/>
+                                                    </span>
+                                                </td>
+
+                                                <!-- IVA 5% -->
+                                                <td style="font-size:9px;font-family: Arial;width:2cm;overflow: auto; text-align: right;">
+                                                    <span t-if="'IVA 5% Venta' in [ilt.name for ilt in l.tax_id] and 'IVA 10% Venta' not in [ilt.name for ilt in l.tax_id]">
+                                                        <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>
+                                                        <t t-set="valor_5" t-value="valor_5+(l.product_uom_qty * l.price_unit)"/>
+                                                    </span>
+                                                </td>
+
+                                                <!-- IVA 10% -->
+                                                <td style="font-size:9px;font-family: Arial;width:2.3cm;overflow: auto; text-align: right;">
+                                                    <span t-if="'IVA 10% Venta' in [ilt.name for ilt in l.tax_id]">
+                                                        <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>
+                                                        <t t-set="valor_10" t-value="valor_10+(l.product_uom_qty * l.price_unit)"/>
+                                                    </span>
+                                                </td>
+                                            </tr>
+                                        </tbody>
+                                    </table>
+                                </div>
+                            </div>
+                            <div style="height:1.9cm;padding-left:1.7cm;">
+                                    <t t-set="total_exentas" t-value="0"/>
+                                    <t t-set="total_5" t-value="0"/>
+                                    <t t-set="total_10" t-value="0"/>
+                                    <t t-set="iva_5" t-value="0"/>
+                                    <t t-set="iva_10" t-value="0"/>
+                                    <t t-set="iva_exentas" t-value="0"/>
+                                    <table class="table borderless table-condensed2">
+                                        <tbody>
+
+                                            <tr>
+                                                <td style="font-size:10px;font-family: Arial;width:1.2cm;overflow: auto; text-align: center;"></td>
+                                                <td style="font-size:10px;font-family: Arial;width:2.0cm;overflow: auto; text-align: center;"></td>
+                                                <td style="font-size:10px;font-family: Arial;width:7.1cm;overflow: auto; text-align: center;"></td>
+                                                <td style="font-size:10px;font-family: Arial;width:2cm;overflow: auto; text-align: center;"></td>
+                                                <td style="font-size:10px;font-family: Arial;width:2.0cm;overflow: auto; text-align: right;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <span t-esc="'{0:,.0f}'.format(valor_exentas)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <span t-esc="'{0:,.2f}'.format(valor_exentas)"/>
+                                                    </t>
+                                                    <t t-set="iva_exentas" t-value="valor_exentas"/>
+                                                </td>
+                                                <td style="font-size:10px;font-family: Arial;width:2.1cm;overflow: auto; text-align: right;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <span t-esc="'{0:,.0f}'.format(valor_5)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <span t-esc="'{0:,.2f}'.format(valor_5)"/>
+                                                    </t>
+                                                    <t t-set="iva_5" t-value="valor_5/21" />
+                                                </td>
+                                                <td style="font-size:10px;font-family: Arial;width:2.3cm;overflow: auto; text-align: right;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <span t-esc="'{0:,.0f}'.format(valor_10)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <span t-esc="'{0:,.2f}'.format(valor_10)"/>
+                                                    </t>
+                                                    <t t-set="iva_10" t-value="(valor_10)/11" />
+                                                </td>
+                                            </tr>
+                                            <!-- <t t-if="i == 2">
+                                                <div class="divisoria2"> </div>
+                                            </t> -->
+                                            <!-- LINEA TOTAL EN LETRAS Y TOTAL GENERAL -->
+                                            <tr>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.2cm;overflow: auto; text-align: center;"></td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.5cm;overflow: auto; text-align: center;"></td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:7cm;overflow: auto; text-align: left;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <div>Gs <span t-esc="convertir('%.0f'%o.amount_total,o.currency_id.en_letras)"/></div>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <div>Dólares <span t-esc="convertir('%.0f'%o.amount_total,o.currency_id.en_letras)"/></div>
+                                                    </t>
+                                                </td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2cm;overflow: auto; text-align: center;"></td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2cm;overflow: auto; text-align: right;"></td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.2cm;overflow: auto; text-align: right;">
+
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.5cm;overflow: auto; text-align: right;">
+                                                    <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>
+                                                </td>
+                                            </tr>
+                                            <!-- TOTAL DE IVA -->
+                                            <div class="divisoria1"> </div>
+
+
+                                            <tr>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.2cm;overflow: auto; text-align: center;"></td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.5cm;overflow: auto; text-align: center;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <div>
+                                                            <t t-if="iva_5 != 0">
+                                                                <span t-esc="'{0:,.0f}'.format(iva_5)"/>
+                                                            </t>
+                                                        </div>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <div>
+                                                            <t t-if="iva_5 != 0">
+                                                                <span t-esc="'{0:,.0f}'.format(iva_5)"/>
+                                                            </t>
+                                                        </div>
+                                                    </t>
+                                                </td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:7cm;overflow: auto; text-align: left;">
+                                                    <t t-if="o.currency_id.id == 166">
+                                                        <div>
+                                                            <t t-if="iva_10 != 0">
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                <span t-esc="'{0:,.0f}'.format(iva_10)"/>
+                                                            </t>
+                                                        </div>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+                                                        <div>
+                                                            <t t-if="iva_10 != 0">
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
+                                                                <span t-esc="'{0:,.0f}'.format(iva_10)"/>
+                                                            </t>
+
+                                                        </div>
+                                                    </t>
+                                                </td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2cm;overflow: auto; text-align: left;">
+                                                    <t t-if="o.currency_id.id == 166">
+
+                                                        <span t-esc="'{0:,.0f}'.format(iva_5+iva_10)"/>
+                                                    </t>
+                                                    <t t-if="o.currency_id.id != 166">
+
+                                                        <span t-esc="'{0:,.0f}'.format(iva_5+iva_10)"/>
+                                                    </t>
+                                                </td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.0cm;overflow: auto; text-align: right;">
+
+                                                </td>
+
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.2cm;overflow: auto; text-align: center;">
+                                                </td>
+                                                <td style="padding-top:0.3cm;font-size:10px;font-family: Arial;width:2.5cm;overflow: auto; text-align: right;">
+                                                </td>
+                                            </tr>
+                                        </tbody>
+                                    </table>
+                            </div>
+                            <div class="logo1"> </div>
+                        </div>
+
+                    </t>
+
+                </div>
+            </t>
+        </t>
+    </template>
+</data>
+</openerp>

+ 92 - 0
numbers_to_letters.py

@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+import unittest
+
+def numero_to_letras(numero):
+	indicador = [("",""),("MIL","MIL"),("MILLON","MILLONES"),("MIL","MIL"),("BILLON","BILLONES")]
+	entero = int(numero)
+	decimal = int(round((numero - entero)*100))
+	#print 'decimal : ',decimal
+	contador = 0
+	numero_letras = ""
+	numero_letrasd = ""
+
+	while entero >0:
+		a = entero % 1000
+		if contador == 0:
+			en_letras = convierte_cifra(a,1).strip()
+		else :
+			en_letras = convierte_cifra(a,0).strip()
+		if a==0:
+			numero_letras = en_letras+" "+numero_letras
+		elif a==1:
+			if contador in (1,3):
+				numero_letras = indicador[contador][0]+" "+numero_letras
+			else:
+				numero_letras = en_letras+" "+indicador[contador][0]+" "+numero_letras
+		else:
+			numero_letras = en_letras+" "+indicador[contador][1]+" "+numero_letras
+
+		numero_letras = numero_letras.strip()
+		contador = contador + 1
+		entero = int(entero / 1000)
+
+
+	contadord=0
+	while decimal >0:
+		d = decimal % 1000
+		if contadord == 0:
+			en_letrasd = convierte_cifra(d,1).strip()
+
+		numero_letrasd =" COM "+str(en_letrasd.strip())
+		contadord = contadord + 1
+		decimal = int(decimal / 1000)
+
+	numero_letras = numero_letras+ str(numero_letrasd)
+	# print 'numero: ',numero
+	# print numero_letras
+	return numero_letras
+
+
+
+def convierte_cifra(numero,sw):
+	lista_centana = ["",("CIEN","CIENTO"),"DOSCIENTOS","TRESCIENTOS","CUATROCIENTOS","QUINIENTOS","SEISCIENTOS","SETECIENTOS","OCHOCIENTOS","NOVECIENTOS"]
+	lista_decena = ["",("DIEZ","ONCE","DOCE","TRECE","CATORCE","QUINCE","DIECISEIS","DIECISIETE","DIECIOCHO","DIECINUEVE"),
+					("VEINTE","VEINTI"),("TREINTA","TREINTA Y "),("CUARENTA" , "CUARENTA Y "),
+					("CINCUENTA" , "CINCUENTA Y "),("SESENTA" , "SESENTA Y "),
+					("SETENTA" , "SETENTA Y "),("OCHENTA" , "OCHENTA Y "),
+					("NOVENTA" , "NOVENTA Y ")
+				]
+	lista_unidad = ["",("UN" , "UNO"),"DOS","TRES","CUATRO","CINCO","SEIS","SIETE","OCHO","NUEVE"]
+	centena = int (numero / 100)
+	decena = int((numero -(centena * 100))/10)
+	unidad = int(numero - (centena * 100 + decena * 10))
+	#print "centena: ",centena, "decena: ",decena,'unidad: ',unidad
+	texto_centena = ""
+	texto_decena = ""
+	texto_unidad = ""
+
+	#Validad las centenas
+	texto_centena = lista_centana[centena]
+	if centena == 1:
+		if (decena + unidad)!=0:
+			texto_centena = texto_centena[1]
+		else :
+	 		texto_centena = texto_centena[0]
+
+
+	#Valida las decenas
+	texto_decena = lista_decena[decena]
+	if decena == 1 :
+		 texto_decena = texto_decena[unidad]
+ 	elif decena > 1 :
+ 		if unidad != 0 :
+ 			texto_decena = texto_decena[1]
+ 		else:
+ 			texto_decena = texto_decena[0]
+ 	#Validar las unidades
+ 	#print "texto_unidad: ",texto_unidad
+ 	if decena != 1:
+ 		texto_unidad = lista_unidad[unidad]
+ 		if unidad == 1:
+ 			texto_unidad = texto_unidad[sw]
+ 	return "%s %s %s" %(texto_centena,texto_decena,texto_unidad)

BIN
numbers_to_letters.pyc


+ 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