Bläddra i källkod

Retocar impresión de recibo de pago

sebas 3 år sedan
incheckning
ab53b8a4fd

+ 2 - 0
__init__.py

@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+import models,res_currency,report_seguirpago

BIN
__init__.pyc


+ 33 - 0
__openerp__.py

@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright :
+#        (c) 2016 FSP, (Ciudad del Este, Paraguay, http://www.eiru.com)
+#                 SP <sistemas@accesoinformatica.com.py>
+#
+##############################################################################
+
+{
+    'name' : 'Seguimiento de pagos',
+    'description': """
+
+Este modulo permite mostrar los seguimientos de pagos y tambien imprimir en pagare.
+
+
+	""",
+    'version': '8.0.1.0.0',
+    'category': 'Accounting',
+    'author' : 'Eiru/Sebastian Penayo',
+    'website': '',
+    'data': [
+        'seguimiento_pagare.xml',
+        'res_currency_view.xml',
+        'views/seguimiento_pago_view.xml',
+    ],
+    'depends' : [
+        'account',
+    ],
+    'installable': True,
+    'auto_install': False,
+}

+ 42 - 0
__openerp__.py~

@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright :
+#        (c) 2016 Jonathan Bravo, (Guayaquil, Ecuador, http://www.jonathanbravo.com)
+#                 Jonathan Bravo <jjbravo88@gmail.com.com>
+#
+##############################################################################
+
+{
+    'name' : 'Odoo Invoice Dashboard V9',
+    'description': """
+
+Este modulo permite mostrar graficos semanales como en al version 9 de odoo.
+--
+This module allows you to display weekly charts as in the version 9 of Odoo.
+
+	""",
+    'version': '8.0.1.0.0',
+    'category': 'Accounting',
+    'author' : 'Jonathan Bravo @jbravot',
+    'complexity': 'normal',
+    'website': 'http://jbravot.github.io/portafolio/',
+    'data': [
+        'views/account_journal_dashboard_view.xml'
+    ],
+    'depends' : [
+        'account',
+        'web_kanban_graph',
+    ],
+    'js': [],
+    'css': [],
+    'qweb': [],
+    "images": [
+		"static/description/example.jpg",
+	],
+    'installable': True,
+    'auto_install': False,
+    'price': 35.00,
+    'currency': 'EUR',
+}

+ 2 - 0
models/__init__.py

@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+import seguimiento_pago

BIN
models/__init__.pyc


+ 82 - 0
models/seguimiento_pago.py

@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 tools
+from openerp.osv import fields, osv
+
+class seguir_pago(osv.osv):
+    """
+    Quants are the smallest unit of stock physical instances
+    """
+    _name = "seguir.pago"
+    _description = "Seguirpago"
+    _auto = False
+    _columns = {
+        'partner_id':fields.many2one('res.partner', 'Cliente', readonly=True),
+        'ref': fields.char('Referencia', readonly=True),
+        'date': fields.date('Fecha Factura', readonly=True),
+		'debit': fields.float('Total', readonly=True),
+        'debit_pyg': fields.float('Total', readonly=True),
+		'date_maturity': fields.date('Vence', readonly=True),
+        'currency_id':fields.many2one('res.currency', 'Moneda', readonly=True),
+        'company_id':fields.many2one('res.company', 'Company', readonly=True),
+        'rate': fields.float('Total', readonly=True),
+        'pagado_usd': fields.float('pagado_usd', readonly=True, default=0),
+        'saldo_usd': fields.float('saldo_usd', readonly=True, default=0),
+        'pagado_pyg': fields.float('pagado_pyg', readonly=True, default=0),
+        'saldo_pyg': fields.float('saldo_pyg', readonly=True, default=0),
+    }
+    _order = 'partner_id desc'
+
+    def init(self, cr):
+		tools.sql.drop_view_if_exists(cr, 'seguir_pago')
+		cr.execute("""
+            CREATE OR REPLACE VIEW seguir_pago as (
+                SELECT	s.id as id,
+	                    s.partner_id as partner_id,
+	                    s.ref as ref,
+	                    s.date as date,
+	                    s.debit as debit,
+	                   (CASE WHEN rrc.amount_tot is null THEN 0 ELSE rrc.amount_tot END) as pagado_usd,
+                       (s.debit - CASE WHEN rrc.amount_tot is null THEN 0 ELSE rrc.amount_tot END ) as saldo_usd,
+                       x.rate as rate,
+                       (s.debit * x.rate) debit_pyg,
+                       (CASE WHEN rrc.amount_tot is null THEN 0 ELSE rrc.amount_tot END * x.rate) as pagado_pyg,
+                       ((s.debit * x.rate) - (CASE WHEN rrc.amount_tot is null THEN 0 ELSE rrc.amount_tot END * x.rate)) as saldo_pyg,
+	                   s.date_maturity as date_maturity,
+                       t.currency_id as currency_id,
+	                   p.id as company_id
+                FROM account_move_line s
+	                   left join account_invoice t on (t.move_id=s.move_id)
+                       left join res_currency d on (d.id=s.currency_id)
+	                   left join res_partner r on (r.id=s.partner_id)
+	                   left join res_company p on (p.id=s.company_id)
+                       left join res_currency_rate x on (x.id =(select max(id)  from res_currency_rate where currency_id =d.id and currency_id=166))
+                       left join (
+		                           Select sum(avl.amount / rc.rate) as amount_tot, move_line_id
+                                   from account_voucher_line avl
+		                                 left join res_currency_rate rc on (rc.id = (SELECT max(rcr.id) FROM res_currency_rate rcr, account_voucher av ,account_journal aj
+		                                       where av.id = avl.voucher_id AND rcr.currency_id = CASE WHEN aj.currency  is null THEN 3 ELSE aj.currency END AND av.journal_id = aj.id ))
+		                          Group by move_line_id) as rrc on s.id = rrc.move_line_id
+                where t.type='out_invoice' and  t.state<>'paid' and s.date_maturity IS NOT NULL AND s.reconcile_id is null
+				GROUP BY s.id,s.partner_id,s.ref,s.date,s.date_maturity,p.id,t.currency_id,s.debit,x.rate, rrc.amount_tot)
+		""")
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
models/seguimiento_pago.pyc


+ 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


+ 28 - 0
report_seguirpago.py

@@ -0,0 +1,28 @@
+from openerp import api, models
+from num2words import num2words
+import numbers_to_letters
+
+class report_seguirpago(models.AbstractModel):
+    _name = 'report.seguimiento_pago.report_pagare_original'
+
+    @api.multi
+    def render_html(self, data=None):
+        report_obj = self.env['report']
+        report = report_obj._get_report_from_name('seguimiento_pago.report_pagare_original')
+        docargs = {
+            'doc_ids': self._ids,
+            'doc_model': report.model,
+            'docs': self.env[report.model].browse(self._ids),
+            'convertir':self.convertir,
+        }
+        return report_obj.render('seguimiento_pago.report_pagare_original', docargs)
+
+    def convertir(self,nro,moneda):
+        # letra = num2words(nro,lang="es")
+        # letra = letra.capitalize()
+        letra = numbers_to_letters.numero_to_letras(nro)
+        if not moneda:
+            moneda=''
+        letra = letra +' '+moneda
+
+        return letra

BIN
report_seguirpago.pyc


+ 31 - 0
res_currency.py

@@ -0,0 +1,31 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    product_features for OpenERP                                                  #
+#    Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).                   #
+#    Authors, Mathieu Lemercier, mathieu@netandco.net,                          #
+#             Franck Bret, franck@netandco.net                                  #
+#    Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.com>   #
+#                                                                               #
+#    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_letras2 = fields.Char('En letras')

BIN
res_currency.pyc


+ 22 - 0
res_currency_view.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  product_features for OpenERP
+  Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).
+    Authors, Mathieu Lemercier, mathieu@netandco.net, Franck Bret, franck@netandco.net
+  Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.com>
+  The licence is in the file __openerp__.py
+-->
+<openerp>
+    <data>
+        <record id="res_currency_en_letras3" model="ir.ui.view">
+            <field name="name">res.currency.en.letras3</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_letras2"/>
+                </field>
+            </field>
+        </record>
+    </data>
+</openerp>

+ 127 - 0
seguimiento_pagare.xml

@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+		 <report id="informe_pagare_original"
+            model="seguir.pago"
+            string="Pagaré"
+            report_type="qweb-pdf"
+            name="seguimiento_pago.report_pagare_original"
+            file="seguimiento_pago.report_pagare_original"
+         />
+<template id="report_pagare_original">
+    <t t-call="report.html_container">
+				<t t-foreach="docs" t-as="o">
+					<t t-call="report.internal_layout">
+			      <div class="page">
+				       <br></br>
+					     <br></br>
+					     <br>
+						     <h2 class="text-center">PAGARE A LA ORDEN</h2>
+					     </br>
+					     <br></br>
+					     <div t-if="o.ref" class="col-xs-6">
+							    <strong>Nro: </strong><i t-field="o.ref"/>
+						   </div>
+						   <div t-if="o.currency_id.id == 3" class="col-xs-6">
+							    <strong>Monto a pagar : $ </strong><i t-field="o.saldo_usd"/>
+						   </div>
+							 <div t-if="o.currency_id.id == 166" class="col-xs-6">
+								 <strong>Monto a pagar : ₲ </strong><i t-field="o.saldo_pyg"/>
+							</div>
+							 <!-- <div t-if="o.debit_pyg" class="col-xs-6">
+								 <strong>Monto a pagar: </strong><i t-field="o.debit_pyg"/><span t-field="o.currency_id.symbol"/>
+							</div> -->
+                    <!-- </br> -->
+               <!-- <br/> -->
+					     <div t-if="o.date" class="col-xs-6">
+						      <strong>Fecha: </strong><i t-field="o.date"/>
+					     </div>
+					      <div t-if="o.date_maturity" class="col-xs-6">
+							     <strong>Vencimiento: </strong><i t-field="o.date_maturity"/>
+					      </div>
+					      <br></br>
+					      <br></br>
+					      <br>
+									<p t-if="o.currency_id.id == 166 ">
+					          <p>Pagaré a <b t-field="o.company_id.name"/> o a su orden el monto de Guaraníes: <b t-esc="convertir(o.saldo_pyg,o.currency_id.en_letras2)"/>.</p>
+									</p>
+									<p t-if="o.currency_id.id == 3 ">
+										<p>Pagaré a <b t-field="o.company_id.name"/> o a su orden el monto de Dolares Americanos: <b t-esc="convertir(o.saldo_usd,o.currency_id.en_letras2)"/>.</p>
+									</p>
+                    <p style="text-align : justify">Por igual valor recibido en _ _ a mi (nuestra) entera satisfacción. Queda expresamente convenido que la falta de pago de este pagaré, me (nos) constituirá(n) en mora automáticamente, sin necesidad de interpelación judicial o extrajudicial alguna, devengando durante el tiempo de la mora un interés del _ _ , un interés moratorio _ _ % por el simple retardo sin que esto implique prórroga del plazo de la obligación. Asimismo, me (nos) obligamos a pagar cualquier gasto en que incurra el acreedor con relación a este préstamo, en caso de que el mismo sea reclamado por la vía judicial o extrajudicial. El simple vencimiento establecerá la mora, autorizando la inclusión de mi Nombre Personal o Razón Social que represento a la base de datos de INFORMCONF conforme a  lo establecido en la Ley 1682/01 y su modificatoria 1969/02, como también para que se pueda proveer la información a terceros  interesados. A los efectos legales y procesales nos sometemos a la jurisdicción de los tribunales de la Ciudad del Este, Alto Paraná y renunciando a cualquier otra que pudiera corresponder. Las partes constituyen domicilio especial en los lugares indicados en el presente documento.</p>
+                </br>
+								<br></br>
+				 	      <div class="row" >
+						        <div class="col-xs-6">
+							          <strong><h3><u>Deudor</u></h3></strong>
+						        </div>
+						        <div class="col-xs-6">
+							          <strong><h3><u>Co-deudor</u></h3></strong>
+						        </div>
+					      </div>
+								<br></br>
+								<br></br>
+
+					       <div class="row">
+						        <div t-if="o.partner_id.name" class="col-xs-6">
+							           <strong>Nombre: </strong><i t-field="o.partner_id.name"/>
+						        </div>
+						        <div class="col-xs-6">
+							           <strong>Nombre: </strong>
+						        </div>
+					       </div>
+					       <div class="row">
+						        <div class="col-xs-6">
+							           <strong>Domicilio: </strong><i t-field="o.partner_id.street"/>
+						        </div>
+						        <div class="col-xs-6">
+							           <strong>Domicilio: </strong>
+						        </div>
+					       </div>
+					       <div class="row">
+						        <div class="col-xs-6">
+							           <strong>Cédula de Identidad: </strong><i t-field="o.partner_id.ruc"/>
+						        </div>
+						        <div class="col-xs-6">
+							           <strong>Cédula de Identidad: </strong>
+						        </div>
+                </div>
+					      <div class="row">
+					          <div class="col-xs-6">
+                         <strong>Teléfono: </strong><i t-field="o.partner_id.phone"/>
+					          </div>
+					          <div class="col-xs-6">
+                         <strong>Teléfono: </strong>
+					          </div>
+                </div>
+								<div class="row">
+										<div class="col-xs-6">
+												 <strong>Celular: </strong><i t-field="o.partner_id.mobile"/>
+										</div>
+								</div>
+					      <br> </br>
+					      <div class="row">
+						        <div class="col-xs-6">
+							           <strong>Firma: _ _ _ _ _ _ _ _</strong>
+						        </div>
+						        <div class="col-xs-6">
+							           <strong>Firma: _ _ _ _ _ _ _ _</strong>
+						        </div>
+                 </div>
+								 <br></br>
+								 <div class="row">
+									 <div class="col-xs-6">
+										  <strong>Aclaración de firma: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _</strong>
+									 </div>
+									 <div class="col-xs-6">
+											<strong>Aclaración de firma: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _</strong>
+									 </div>
+								 </div>
+				    </div>
+			  </t>
+		  </t>
+    </t>
+
+</template>
+</data>
+</openerp>

BIN
static/description/icon.png


+ 52 - 0
views/seguimiento_pago_view.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+  <data>
+
+    <record id="account_seguimiento_pago_action"  model="ir.actions.act_window">
+        <field name="name">Seguimiento de Pagos</field>
+        <field name="res_model">seguir.pago</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree</field>
+    </record>
+
+
+    <record id="seguimiento_pago_tree" model="ir.ui.view">
+            <field name="name">seguimiento.pago.tree</field>
+            <field name="model">seguir.pago</field>
+            <field name="view_type">tree</field>
+            <field name="arch" type="xml">
+                <tree ditable='bottom' delete='false' create='false'>
+                  <field name="date"/>
+                  <field name="ref"/>
+                  <field name="partner_id"/>
+                  <field name="date_maturity"/>
+                  <field name="debit" string="Total USD" sum="Total debit USD"/>
+                  <field name='pagado_usd' string="Pagado USD" sum="Total Pagado USD"/>
+                  <field name='saldo_usd' string="Saldo USD" sum="Saldo Total USD" />
+                  <field name="debit_pyg" string="Total PYG" sum="Total debit PYG" />
+                  <field name='pagado_pyg' string="Pagado PYG" sum="Total Pagado PYG"/>
+                  <field name='saldo_pyg' string="Saldo PYG" sum="Saldo Total PYG"/>
+                  <field name="currency_id"/>
+                </tree>
+            </field>
+      </record>
+
+      <record id="view_seguimiento_pago_search" model="ir.ui.view">
+          <field name="name">seguimiento.pago.search</field>
+          <field name="model">seguir.pago</field>
+          <field name="arch" type="xml">
+               <search >
+                 <field name="ref"/>
+                 <field name="partner_id"/>
+                 <field name="currency_id"/>
+               </search>
+          </field>
+      </record>
+
+
+    <menuitem id="menu_seguimiento_pago_1" name="Impresión de Pagaré" parent="account.menu_finance" sequence="3"/>
+    <menuitem id="submenu_seguimiento_pago_1" name="Impresión de  Pagaré" action="account_seguimiento_pago_action"
+              parent="menu_seguimiento_pago_1" sequence="3"/>
+
+  </data>
+</openerp>