← Back to team overview

clearcorp team mailing list archive

lp:~dr.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_voucher_check_bcr into lp:openerp-costa-rica/6.1

 

Diana Rodríguez Martínez has proposed merging lp:~dr.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_voucher_check_bcr into lp:openerp-costa-rica/6.1.

Requested reviews:
  CLEARCORP drivers (clearcorp-drivers)

For more details, see:
https://code.launchpad.net/~dr.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_voucher_check_bcr/+merge/109400

[ADD] l10n_cr_account_voucher_check_bcr - Module that is responsible for generating the check for the BCR
-- 
https://code.launchpad.net/~dr.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_voucher_check_bcr/+merge/109400
Your team CLEARCORP development team is subscribed to branch lp:openerp-costa-rica/6.1.
=== added directory 'l10n_cr_account_voucher_check_bcr'
=== added file 'l10n_cr_account_voucher_check_bcr/__init__.py'
--- l10n_cr_account_voucher_check_bcr/__init__.py	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_voucher_check_bcr/__init__.py	2012-06-08 17:23:30 +0000
@@ -0,0 +1,1 @@
+import report

=== added file 'l10n_cr_account_voucher_check_bcr/__openerp__.py'
--- l10n_cr_account_voucher_check_bcr/__openerp__.py	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_voucher_check_bcr/__openerp__.py	2012-06-08 17:23:30 +0000
@@ -0,0 +1,44 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    account_voucher_check.py
+#    account_voucher_check
+#    First author: Mag Guevara <mag.guevara@xxxxxxxxxxxxxxx> (ClearCorp S.A.)
+#    Copyright (c) 2011-TODAY ClearCorp S.A. (http://clearcorp.co.cr). All rights reserved.
+#    
+#    Redistribution and use in source and binary forms, with or without modification, are
+#    permitted provided that the following conditions are met:
+#    
+#       1. Redistributions of source code must retain the above copyright notice, this list of
+#          conditions and the following disclaimer.
+#    
+#       2. Redistributions in binary form must reproduce the above copyright notice, this list
+#          of conditions and the following disclaimer in the documentation and/or other materials
+#          provided with the distribution.
+#    
+#    THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY EXPRESS OR IMPLIED
+#    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+#    FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
+#    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+#    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+#    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+#    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+#    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#    
+#    The views and conclusions contained in the software and documentation are those of the
+#    authors and should not be interpreted as representing official policies, either expressed
+#    or implied, of ClearCorp S.A..
+#    
+##############################################################################
+{
+	"name"        : "Voucher Check BCR",
+	"author"      : "ClearCorp S.A.",
+	"version"     : "0.1",
+	"depends"     : ["base","account","report_webkit","base_currency_symbol"],
+	"init_xml"    : [],
+	"update_xml"  : ['l10n_cr_account_voucher_check_bcr_view.xml','l10n_cr_account_voucher_check_bcr_report.xml',],
+	"category"    : "Accounting",
+	"active"      : False,
+	"instalable"  : True,
+}

=== added directory 'l10n_cr_account_voucher_check_bcr/i18n'
=== added file 'l10n_cr_account_voucher_check_bcr/i18n/es_CR.po'
--- l10n_cr_account_voucher_check_bcr/i18n/es_CR.po	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_voucher_check_bcr/i18n/es_CR.po	2012-06-08 17:23:30 +0000
@@ -0,0 +1,86 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* ccorp_payment_receipt
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.3\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2012-01-03 22:28+0000\n"
+"PO-Revision-Date: 2012-01-03 22:28+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:39
+msgid "Check No."
+msgstr "CHEQUE No."
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:13
+msgid "No."
+msgstr "No."
+
+#. module: ccorp_payment_receipt
+#: model:ir.actions.report.xml,name:ccorp_payment_receipt.account_voucher_ccorp
+msgid "Payment Voucher"
+msgstr "Imprimir Recibo"
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:46
+msgid "AUTORIZADO MEDIANTE OFICIO No.04-00007-97 DE FECHA 30-09-97 DE LA D.G.T.D."
+msgstr "AUTORIZADO MEDIANTE OFICIO No.04-00007-97 DE FECHA 30-09-97 DE LA D.G.T.D."
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:23
+msgid "Concept of"
+msgstr "POR CONCEPTO DE"
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:45
+msgid "LA VALIDEZ DE ESTE RECIBO QUEDA SUJETA A QUE LOS CHEQUES RECIBIDOS SEAN PAGADOS POR EL BANCO A NUESTRA SATISFACCION"
+msgstr "LA VALIDEZ DE ESTE RECIBO QUEDA SUJETA A QUE LOS CHEQUES RECIBIDOS SEAN PAGADOS POR EL BANCO A NUESTRA SATISFACCION"
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:37
+msgid "Cash"
+msgstr "EFECTIVO"
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:20
+msgid "The amount of"
+msgstr "LA SUMA DE"
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:26
+msgid "Observations"
+msgstr "OBSERVACIONES"
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:49
+msgid "P/"
+msgstr "P/"
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:17
+msgid "We recieve from"
+msgstr "RECIBIMOS DE"
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:1
+msgid "MONEY RECEIPT"
+msgstr "RECIBO DE DINERO"
+
+#. module: ccorp_payment_receipt
+#: report:report.account.voucher.layout_ccorp:1
+msgid "Date"
+msgstr "FECHA"
+
+#. module: ccorp_payment_receipt
+#: report:addons/ccorp_payment_receipt/report/payment_receipt.mako:23
+msgid "In words"
+msgstr "EN LETRAS"

=== added file 'l10n_cr_account_voucher_check_bcr/l10n_cr_account_voucher_check_bcr_report.xml'
--- l10n_cr_account_voucher_check_bcr/l10n_cr_account_voucher_check_bcr_report.xml	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_voucher_check_bcr/l10n_cr_account_voucher_check_bcr_report.xml	2012-06-08 17:23:30 +0000
@@ -0,0 +1,197 @@
+<?xml version="1.0"?>
+<openerp>
+    <data >
+        <record id="webkit_header_l10n_cr_account_voucher_check_bcr" model="ir.header_webkit">
+            <field name="name">Imprimir Cheque BCR</field>
+            <field name="orientation">Portrait</field>
+            <field name="format">Letter</field>
+            <field eval="0.50" name="margin_top"/>
+            <field eval="0.0" name="margin_bottom"/>
+            <field eval="0.10" name="margin_left"/>
+            <field eval="0.10" name="margin_right"/>
+            <field name="html"><![CDATA[<html> </html>]]></field>
+            <field name="css"><![CDATA[
+body {
+    /*margin-top : 10px;cambio de 20 a 10*/
+}
+
+#wrapper{
+
+}
+
+#document_data{
+    /*padding : 5px;*/
+    padding-top : 15px;
+    width : 100%;
+    height : 185px;/*cambio de 210 a 200*/
+}
+
+#date {
+    margin : 20px 0px 5px 350px;/*cambio de 400 a 200*/
+}
+
+#detail {
+    margin-top : 13px;
+    width : 100%;
+    
+}
+
+.amount_detail {
+    margin : 0px 0px 0px 375px;/*cambio de 400 a 200*/
+}
+
+#accounting_data {
+    /*margin-right : 100px;*/
+    
+}
+
+#document_desc {
+    height : 90px;/*cambio de 110 a 90*/
+    margin-bottom : 10px;/*cambio de 7 a 3*/
+    width : 100%;
+}
+
+#accounts{
+    margin-top : 4px;/*cambio de 8 a 2*/
+    margin-bottom : 7px;/*cambio de 13 a 7*/
+    height : 250px;/*cambio de 290 a 250*/
+    width : 82%;
+    /*width : 660px; /*643*/
+}
+
+#table_account{
+    border-collapse: collapse;
+}
+
+#table_account td {
+    padding: 3px;
+}
+
+#table_account tr.account_line td {
+    border: 0px solid black;
+    border-bottom-width: 1px;
+    font-family : sans-serif;
+    font-size : 13px;
+}
+
+#footer_data{}
+
+.detail_desc{
+    font-family : sans-serif;
+    font-size : 13px;
+    font-style : italic;
+}
+
+.text_font{
+    font-family : sans-serif;
+    font-size : 13px;
+}
+
+.amount{
+    font-family : sans-serif;
+    font-size : 13px;
+    font-style : italic;
+}
+
+.account_line{
+    font-family : sans-serif;
+    font-size : 13px;
+}
+.detail_line{
+    width : 60%;/*cambio de 70 a 30*/
+    float : left;
+    margin-left : 50px;/*cambio de 70 a 30*/
+}
+.amount_text{
+    /*margin : 5px;*/
+    width : 70%;
+    margin-top : 15px;
+    margin-left : 50px;/*cambio de 70 a 30*/
+    word-spacing:-1px;
+}
+
+
+.account_id{
+    width : 288px;
+    text-align : left;
+    word-spacing:-1px;
+}
+
+.code_cell {
+    width : 120px;/*125*/
+    text-align : left;
+}
+
+.code_div {
+    float : left;
+    width : 120px;
+    
+}
+
+.amount_acc {
+    width : 120px;/*125*/
+    text-align : right;
+    word-spacing:-1px;
+}
+
+.made_by{
+    float : left;
+    width : 85px;
+    margin-left : 5px;
+    font-family : sans-serif;
+    font-size : 13px;
+    text-align : center;
+}
+
+#receipt {
+    float : left;
+    margin-left : 15px;
+}
+
+#related{
+    float : left;
+}
+
+.sub_receipt{
+    width : 140px;
+    font-family : sans-serif;
+    font-size : 10px;
+    text-align : center;
+}
+
+ td {border-collapse: collapse; }
+ 
+.amount_desc {
+    font-family : sans-serif;
+    font-size : 13px;
+    word-spacing: -2px;
+ }
+
+.amount_desc_medium {
+    font-family : sans-serif;
+    font-size : 10px;
+    word-spacing: -2px;
+ }
+
+.amount_desc_small {
+    font-family : sans-serif;
+    font-size : 8.2px;
+    word-spacing: 0px;
+ }
+                 ]]> 
+            </field>
+        </record>
+        <report auto="False"
+                id="webkit_report_l10n_cr_account_voucher_check_bcr"
+                model="account.voucher"
+                name="webkit_report_l10n_cr_account_voucher_check_bcr"
+                file="account_voucher_check/report/l10n_cr_account_voucher_check_bcr.mako"
+                string="Imprimir Cheque BCR"
+                report_type="webkit"
+               
+        />
+        <record id="webkit_report_l10n_cr_account_voucher_check_bcr" model="ir.actions.report.xml">
+            <field name="webkit_header" ref="webkit_header_l10n_cr_account_voucher_check_bcr" />
+        </record>
+    </data>
+</openerp>

=== added file 'l10n_cr_account_voucher_check_bcr/l10n_cr_account_voucher_check_bcr_view.xml'
--- l10n_cr_account_voucher_check_bcr/l10n_cr_account_voucher_check_bcr_view.xml	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_voucher_check_bcr/l10n_cr_account_voucher_check_bcr_view.xml	2012-06-08 17:23:30 +0000
@@ -0,0 +1,83 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<openerp>
+	<data>
+
+		<!--
+		======================================
+					accounts
+		======================================
+		
+		
+		<record model="ir.ui.view" id="view_check_form">
+			<field name="name">account.voucher.check.form</field>
+			<field name="model">account.voucher</field>
+			<field name="type">form</field>
+			<field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
+				<field name="arch" type="xml">
+					<data>
+						<field name = "company_id" position = "after">
+							<field name = "amount_text" required="1"/>
+						</field>
+					</data>
+				</field>
+		</record>
+-->
+			<record id="action_check_payment" model="ir.actions.act_window">
+				<field name="name">Check Payment</field>
+				<field name="res_model">account.voucher</field>
+				<field name="view_type">form</field>
+				<field name="domain">[('journal_id.type', 'in', ['bank']), ('type','=','payment')]</field>
+				<field name="context">{'type':'payment'}</field>
+				<field name="view_id" eval="False"/>
+				<field name="search_view_id" ref="account_voucher.view_voucher_filter_vendor_pay"/>
+				<field name="target">current</field>
+				<field name="help">The Check payment form allows you to track the payment by check you do to your suppliers. When you select a supplier, the payment method and an amount for the payment, OpenERP will propose to reconcile your payment with the open supplier invoices or bills.</field>
+			</record>
+			<record id="action_check_payment_tree" model="ir.actions.act_window.view">
+				<field eval="1" name="sequence"/>
+				<field name="view_mode">tree</field>
+				<field name="act_window_id" ref="action_check_payment"/>
+			</record>
+			<record id="action_check_payment_form" model="ir.actions.act_window.view">
+				<field eval="2" name="sequence"/>
+				<field name="view_mode">form</field>
+				<field name="view_id" ref="account_voucher.view_vendor_payment_form"/>
+				<field name="act_window_id" ref="action_check_payment"/>
+			</record>
+            
+            <record model = "ir.ui.view" id = "rent_invoice_form_view">
+                <field name = "name">check.invoice.supplier.form</field>
+                <field name = "model">account.invoice</field>
+                <field name = "type">form</field>
+                <field name = "inherit_id" ref = "account.invoice_supplier_form"/>
+                <field name = "arch" type="xml">
+                    <data>
+                        <field name="date_invoice" position="before">
+                            <field name = "name" />
+                        </field>
+                    </data>
+                </field>
+            </record>
+            
+<!--
+            <record model = "ir.ui.view" id = "rent_invoice_tree_view">
+                <field name = "name">check.invoice.supplier.tree</field>
+                <field name = "model">account.invoice</field>
+                <field name = "type">tree</field>
+                <field name = "inherit_id" ref = "account.invoice_tree"/>
+                <field name = "arch" type="xml">
+                    <data>
+                        <field name="company_id" position="after">
+                            <field name = "name" />
+                        </field>
+                    </data>
+                </field>
+            </record>
+-->
+            
+
+        <menuitem action="action_check_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
+            id="menu_action_vendor_payment"  parent="account.menu_finance_payables"/>
+	</data>
+</openerp>
+

=== added directory 'l10n_cr_account_voucher_check_bcr/report'
=== added file 'l10n_cr_account_voucher_check_bcr/report/__init__.py'
--- l10n_cr_account_voucher_check_bcr/report/__init__.py	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_voucher_check_bcr/report/__init__.py	2012-06-08 17:23:30 +0000
@@ -0,0 +1,35 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    __init__.py
+#    check_voucher
+#    First author: Mag Guevara <mag.guevara@xxxxxxxxxxxxxxx> (ClearCorp S.A.)
+#    Copyright (c) 2011-TODAY ClearCorp S.A. (http://clearcorp.co.cr). All rights reserved.
+#    
+#    Redistribution and use in source and binary forms, with or without modification, are
+#    permitted provided that the following conditions are met:
+#    
+#       1. Redistributions of source code must retain the above copyright notice, this list of
+#          conditions and the following disclaimer.
+#    
+#       2. Redistributions in binary form must reproduce the above copyright notice, this list
+#          of conditions and the following disclaimer in the documentation and/or other materials
+#          provided with the distribution.
+#    
+#    THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY EXPRESS OR IMPLIED
+#    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+#    FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
+#    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+#    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+#    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+#    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+#    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#    
+#    The views and conclusions contained in the software and documentation are those of the
+#    authors and should not be interpreted as representing official policies, either expressed
+#    or implied, of ClearCorp S.A..
+#    
+##############################################################################
+
+import l10n_cr_account_voucher_check_bcr

=== added file 'l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr.mako'
--- l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr.mako	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr.mako	2012-06-08 17:23:30 +0000
@@ -0,0 +1,94 @@
+<html>
+<head>
+    <style style="text/css">
+        ${css}
+    </style>
+</head>
+<body class = "data">
+    %for check in objects :
+    <% setLang(check.partner_id.lang) %>
+    <div id="wrapper">
+        <div id = "document_data">
+            <div id = "date">
+                <span class="text_font">${check.date or ''|entity}</span>
+            </div>
+            <div id = "detail">
+                <div class = "detail_line">
+                    <span class="text_font">${check.partner_id.name or ''|entity}</span>
+                </div>
+                <div class = "amount_detail">
+                    <span class = "amount">${formatLang(check.amount)}</span>
+                </div>
+            </div>
+            %if count_text(check.amount,check.currency_id,check.partner_id.lang,check.company_id) < 50 :
+            <div class = "amount_text">
+                <span class="amount_desc">${get_text(check.amount,check.currency_id,check.partner_id.lang,check.company_id) or ''|entity}</span>
+            </div>
+            %elif count_text(check.amount,check.currency_id,check.partner_id.lang,check.company_id) > 50 and get_text(check.amount,check.currency_id,check.partner_id.lang,check.company_id) < 80:
+            <div class = "amount_text">
+                <span class="amount_desc_medium">${get_text(check.amount,check.currency_id,check.partner_id.lang,check.company_id) or ''|entity}</span>
+            </div>
+            %else :
+            <div class = "amount_text">
+                <span class="amount_desc_small">${get_text(check.amount,check.currency_id,check.partner_id.lang,check.company_id) or ''|entity}</span>
+            </div>
+            %endif
+        </div>
+        <div id = "accounting_data">
+            <div id = "document_desc">
+                <p>&nbsp;</p>
+                <div class = "detail_desc">
+                    %if check.name:
+                    <span class = "text_font">${check.name or ''|entity}</span>
+                    %endif
+                    %for line in check.move_ids :
+                    %if line.invoice.name:
+                        <span class = "text_font">${ line.invoice.name or ''|entity}</span>
+                        <span>&nbsp;</span>
+                    %endif
+                    %endfor
+                </div>
+            </div>
+            </br>
+            <div id = "accounts">
+                <table width = "100%" id = "table_account" cellpadding = "0" cellspacing = "0">
+                    <thead><tr><th>&nbsp;</th><th>&nbsp;</th><th>&nbsp;</th><th>&nbsp;</th></tr></thead>
+                    <tbody>
+                    %for line in check.move_ids :
+                    <tr class = "account_line">
+                        <td valign="middle" class = "code_cell">
+                            ${line.account_id.code}
+                        </td>
+                        <td valign="middle" class = "account_id">
+                            ${line.account_id.name}
+                        </td>
+                        <td valign="middle" class = "amount_acc">
+                            ${line.account_id.currency_id.symbol_prefix or ''|entity} ${formatLang(line.debit)} ${line.account_id.currency_id.symbol_suffix or ''|entity}
+                        </td>
+                        <td valign="middle" class = "amount_acc">
+                            ${line.account_id.currency_id.symbol_prefix or ''|entity} ${formatLang(line.credit)} ${line.account_id.currency_id.symbol_suffix or ''|entity}
+                        </td>
+                    </tr>
+                    %endfor
+                    <tr>
+                        <td colspan="4">&nbsp;</td>
+                    </tr>
+                    <tr>
+                        <td class="code_cell">No. Pago: </td>
+                        <td class="account_id">${check.number}</td>
+                        <td colspan="2">&nbsp;</td>
+                    </tr>
+                    <tr>
+                        <td class="code_cell">No. Cheque: </td>
+                        <td class="account_id">${check.reference}</td>
+                        <td colspan="2">&nbsp;</td>
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+    <p style="page-break-after:always"></p>
+%endfor
+</body>
+</html>

=== added file 'l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr.py'
--- l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr.py	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr.py	2012-06-08 17:23:30 +0000
@@ -0,0 +1,99 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    check_voucher.py
+#    account_voucher_check
+#    First author: Mag Guevara <mag.guevara@xxxxxxxxxxxxxxx> (ClearCorp S.A.)
+#    Second author: Juan Felipe Muñoz <juan.munoz@xxxxxxxxxxxxxxx> (ClearCorp S.A.)
+#    Copyright (c) 2010-TODAY ClearCorp S.A. (http://clearcorp.co.cr). All rights reserved.
+#    
+#    Redistribution and use in source and binary forms, with or without modification, are
+#    permitted provided that the following conditions are met:
+#    
+#       1. Redistributions of source code must retain the above copyright notice, this list of
+#          conditions and the following disclaimer.
+#    
+#       2. Redistributions in binary form must reproduce the above copyright notice, this list
+#          of conditions and the following disclaimer in the documentation and/or other materials
+#          provided with the distribution.
+#    
+#    THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY EXPRESS OR IMPLIED
+#    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+#    FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
+#    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+#    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+#    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+#    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+#    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#    
+#    The views and conclusions contained in the software and documentation are those of the
+#    authors and should not be interpreted as representing official policies, either expressed
+#    or implied, of ClearCorp S.A..
+#    
+##############################################################################
+
+import time
+import pooler
+from report import report_sxw
+from l10n_cr_account_voucher_check_bcr_amount_to_text import number_to_text_es
+import locale
+#from tools import #debug
+
+class check_voucher(report_sxw.rml_parse):
+
+    def __init__(self, cr, uid, name, context):
+        super(check_voucher, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update({
+            'time': time,
+            'cr'  : cr,
+            'uid' : uid,
+            'get_text':self.get_text,
+            'count_text':self.count_text,
+            'get_concept':self.get_concept,
+        })
+        self.context = context
+        self._node = None
+
+
+    def get_text(self,amount,currency,lang,company_id):
+        separator = ','
+        decimal_point = '.'
+        name_currency = currency.currency_name
+        if name_currency == False:
+            name_currency = company_id.currency_id.currency_name
+        if name_currency == None:
+            name_currency = company_id.currency_id.currency_name
+        if lang:
+            lang_pool = self.pool.get('res.lang')
+            id_lang = lang_pool.search(self.cr,self.uid,[('code','=',lang)])
+            obj_lang = lang_pool.browse(self.cr,self.uid,id_lang)[0]
+            separator = obj_lang  and obj_lang.thousands_sep or separator
+            decimal_point = obj_lang  and obj_lang.decimal_point or decimal_point
+        #debug(separator)
+        #debug(decimal_point)
+        res = number_to_text_es(amount,name_currency,separator=separator,decimal_point=decimal_point)
+        return res
+        
+        
+        
+    def count_text(self,amount,currency,lang,company_id):
+        res = len(self.get_text(amount,currency,lang,company_id))
+        return res
+        
+        
+    def get_concept(self,moves):
+        res = 'error'
+        for move in moves:
+            move_line = self.pool.get('acccount.move.line').browse(self.cr,self.uid,move.id)
+            invoice = self.pool.get('account.invoice').browse(self.cr,self.uid,move_line.invoice)
+            if invoice.name != ''or invoice.name != False:
+                res = invoice.name
+        return res
+        
+report_sxw.report_sxw(
+    'report.webkit_report_l10n_cr_account_voucher_check_bcr',
+    'account.voucher',
+    'addons/account_voucher_check/report/l10n_cr_account_voucher_check_bcr.mako',
+    parser=check_voucher
+)

=== added file 'l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr_amount_to_text.py'
--- l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr_amount_to_text.py	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr_amount_to_text.py	2012-06-08 17:23:30 +0000
@@ -0,0 +1,130 @@
+#!/usr/bin/python                   
+# -*- coding: utf-8 -*-
+
+#from tools import #debug
+UNIDADES = (
+    '',     
+    'UN ',  
+    'DOS ', 
+    'TRES ',
+    'CUATRO ',
+    'CINCO ', 
+    'SEIS ',  
+    'SIETE ', 
+    'OCHO ',  
+    'NUEVE ', 
+    'DIEZ ',  
+    'ONCE ',  
+    'DOCE ',  
+    'TRECE ', 
+    'CATORCE ',
+    'QUINCE ', 
+    'DIECISEIS ',
+    'DIECISIETE ',
+    'DIECIOCHO ', 
+    'DIECINUEVE ',
+    'VEINTE '     
+)                 
+DECENAS = (       
+    'VENTI',      
+    'TREINTA ',   
+    'CUARENTA ',  
+    'CINCUENTA ', 
+    'SESENTA ',   
+    'SETENTA ',   
+    'OCHENTA ',   
+    'NOVENTA ',   
+    'CIEN '       
+)                 
+CENTENAS = (      
+    'CIENTO ',    
+    'DOSCIENTOS ',
+    'TRESCIENTOS ',
+    'CUATROCIENTOS ',
+    'QUINIENTOS ',   
+    'SEISCIENTOS ',  
+    'SETECIENTOS ',  
+    'OCHOCIENTOS ',  
+    'NOVECIENTOS '   
+)                    
+                     
+def number_to_text_es(number_in,currency,join_dec=' Y ',separator=',',decimal_point='.'):
+                              
+    converted = ''                              
+    if currency == False:
+        currency = ''
+        
+    if currency == None:
+        currency = ''
+
+    if type(number_in) != 'str':
+      number = str(number_in)   
+    else:                       
+      number = number_in        
+     
+    number_str=number
+    #if we are using the coma as separator we need to remove them from the string
+    try:
+      number_str = number_str.replace(separator,'')
+    except ValueError:
+      print 'The separator used for the thousands its not supported'
+    
+    #debug(number_str)                                      
+                                                           
+    try:                                                   
+      number_int, number_dec = number_str.split(decimal_point)       
+    except ValueError:                                     
+      number_int = number_str                              
+      number_dec = ""                                      
+
+    number_str = number_int.zfill(9)
+    millones = number_str[:3]       
+    miles = number_str[3:6]         
+    cientos = number_str[6:]        
+
+    if(millones):
+        if(millones == '001'):
+            converted += 'UN MILLON '
+        elif(int(millones) > 0):     
+            converted += '%sMILLONES ' % __convertNumber(millones)
+                                                                  
+    if(miles):                                                    
+        if(miles == '001'):                                       
+            converted += 'MIL '                                   
+        elif(int(miles) > 0):                                     
+            converted += '%sMIL ' % __convertNumber(miles)        
+    if(cientos):                                                  
+        if(cientos == '001'):                                     
+            converted += 'UN '                                    
+        elif(int(cientos) > 0):                                   
+            converted += '%s ' % __convertNumber(cientos)         
+
+    if number_dec == "":
+      number_dec = "00" 
+    if (len(number_dec) < 2 ):
+      number_dec+='0'         
+
+    has_decimal = float(number_dec) != 0 and join_dec + number_dec + "/100" or ' EXACTOS'
+    converted += currency +  has_decimal
+    
+
+    return converted
+                    
+def __convertNumber(n):
+    output = ''
+
+    if(n == '100'):
+        output = "CIEN "
+    elif(n[0] != '0'):
+        output = CENTENAS[int(n[0])-1]
+
+    k = int(n[1:])
+    if(k <= 20):
+        output += UNIDADES[k]
+    else:
+        if((k > 30) & (n[2] != '0')):
+            output += '%sY %s' % (DECENAS[int(n[1])-2], UNIDADES[int(n[2])])
+        else:
+            output += '%s%s' % (DECENAS[int(n[1])-2], UNIDADES[int(n[2])])
+
+    return output

=== added file 'l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr_check_voucher.py'
--- l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr_check_voucher.py	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_voucher_check_bcr/report/l10n_cr_account_voucher_check_bcr_check_voucher.py	2012-06-08 17:23:30 +0000
@@ -0,0 +1,100 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    check_voucher.py
+#    account_voucher_check
+#    First author: Mag Guevara <mag.guevara@xxxxxxxxxxxxxxx> (ClearCorp S.A.)
+#    Second author: Juan Felipe Muñoz <juan.munoz@xxxxxxxxxxxxxxx> (ClearCorp S.A.)
+#    Third author: Diana Rodriguez <diana.rodriguez@xxxxxxxxxxxxxxx>(ClearCorp S.A)
+#    Copyright (c) 2010-TODAY ClearCorp S.A. (http://clearcorp.co.cr). All rights reserved.
+#    
+#    Redistribution and use in source and binary forms, with or without modification, are
+#    permitted provided that the following conditions are met:
+#    
+#       1. Redistributions of source code must retain the above copyright notice, this list of
+#          conditions and the following disclaimer.
+#    
+#       2. Redistributions in binary form must reproduce the above copyright notice, this list
+#          of conditions and the following disclaimer in the documentation and/or other materials
+#          provided with the distribution.
+#    
+#    THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY EXPRESS OR IMPLIED
+#    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+#    FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
+#    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+#    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+#    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+#    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+#    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#    
+#    The views and conclusions contained in the software and documentation are those of the
+#    authors and should not be interpreted as representing official policies, either expressed
+#    or implied, of ClearCorp S.A..
+#    
+##############################################################################
+
+import time
+import pooler
+from report import report_sxw
+from l10n_cr_account_voucher_check_bcr_amount_to_text import number_to_text_es
+import locale
+#from tools import #debug
+
+class check_voucher(report_sxw.rml_parse):
+
+    def __init__(self, cr, uid, name, context):
+        super(check_voucher, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update({
+            'time': time,
+            'cr'  : cr,
+            'uid' : uid,
+            'get_text':self.get_text,
+            'count_text':self.count_text,
+            'get_concept':self.get_concept,
+        })
+        self.context = context
+        self._node = None
+
+
+    def get_text(self,amount,currency,lang,company_id):
+        separator = ','
+        decimal_point = '.'
+        name_currency = currency.currency_name
+        if name_currency == False:
+            name_currency = company_id.currency_id.currency_name
+        if name_currency == None:
+            name_currency = company_id.currency_id.currency_name
+        if lang:
+            lang_pool = self.pool.get('res.lang')
+            id_lang = lang_pool.search(self.cr,self.uid,[('code','=',lang)])
+            obj_lang = lang_pool.browse(self.cr,self.uid,id_lang)[0]
+            separator = obj_lang  and obj_lang.thousands_sep or separator
+            decimal_point = obj_lang  and obj_lang.decimal_point or decimal_point
+        #debug(separator)
+        #debug(decimal_point)
+        res = number_to_text_es(amount,name_currency,separator=separator,decimal_point=decimal_point)
+        return res
+        
+        
+        
+    def count_text(self,amount,currency,lang,company_id):
+        res = len(self.get_text(amount,currency,lang,company_id))
+        return res
+        
+        
+    def get_concept(self,moves):
+        res = 'error'
+        for move in moves:
+            move_line = self.pool.get('acccount.move.line').browse(self.cr,self.uid,move.id)
+            invoice = self.pool.get('account.invoice').browse(self.cr,self.uid,move_line.invoice)
+            if invoice.name != ''or invoice.name != False:
+                res = invoice.name
+        return res
+        
+report_sxw.report_sxw(
+    'report.webkit_report_l10n_cr_account_voucher_check_bcr',
+    'account.voucher',
+    'addons/account_voucher_check/report/l10n_cr_account_voucher_check_bcr.mako',
+    parser=check_voucher
+)


Follow ups