← Back to team overview

clearcorp team mailing list archive

lp:~as.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_financial_report_webkit into lp:openerp-costa-rica

 

Armando Soto Rodríguez has proposed merging lp:~as.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_financial_report_webkit into lp:openerp-costa-rica.

Requested reviews:
  CLEARCORP drivers (clearcorp-drivers)

For more details, see:
https://code.launchpad.net/~as.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_financial_report_webkit/+merge/113307

[ADD] Added report_currency_id to account_account.py
[FIX] Reports changed to use report_currency_id
-- 
https://code.launchpad.net/~as.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_financial_report_webkit/+merge/113307
Your team CLEARCORP development team is subscribed to branch lp:openerp-costa-rica.
=== modified file 'l10n_cr_account_financial_report_webkit/__init__.py'
--- l10n_cr_account_financial_report_webkit/__init__.py	2012-06-01 19:28:10 +0000
+++ l10n_cr_account_financial_report_webkit/__init__.py	2012-07-03 21:44:20 +0000
@@ -20,3 +20,4 @@
 import account
 from . import wizard
 from . import report
+from . import account_account

=== modified file 'l10n_cr_account_financial_report_webkit/__openerp__.py'
--- l10n_cr_account_financial_report_webkit/__openerp__.py	2012-06-22 20:40:49 +0000
+++ l10n_cr_account_financial_report_webkit/__openerp__.py	2012-07-03 21:44:20 +0000
@@ -94,6 +94,7 @@
                    'wizard/l10n_cr_open_invoices_wizard_view.xml',
                    'wizard/l10n_cr_partners_ledger_wizard_view.xml',
                    'report_menus.xml',
+                   'account_view.xml',
                    ],
     'test': [],
     'active': False,

=== added file 'l10n_cr_account_financial_report_webkit/account_account.py'
--- l10n_cr_account_financial_report_webkit/account_account.py	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_financial_report_webkit/account_account.py	2012-07-03 21:44:20 +0000
@@ -0,0 +1,33 @@
+#-*- coding:utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    d$
+#
+#    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/>.
+#
+##############################################################################
+
+import netsvc
+from osv import fields, orm
+import tools
+from tools.translate import _
+
+class AccountAccount(orm.Model):
+    _inherit = "account.account"
+    
+    _columns = {
+        'report_currency_id': fields.many2one('res.currency', 'Report Currency', help="Currency to show in the reports."),
+    }

=== added file 'l10n_cr_account_financial_report_webkit/account_view.xml'
--- l10n_cr_account_financial_report_webkit/account_view.xml	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_financial_report_webkit/account_view.xml	2012-07-03 21:44:20 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <!-- Accounts -->
+        <record id="l10n_cr_account_financial_report_view_account_form" model="ir.ui.view">
+            <field name="name">l10n.cr.account.financial.report.view.account.form</field>
+            <field name="model">account.account</field>
+            <field name="type">form</field>
+            <field name="inherit_id" ref="account.view_account_form"/>
+            <field name="arch" type="xml">
+                <data>                
+                    <field name = "currency_mode" position = "after">
+                        <field name="report_currency_id" attrs="{'required':[('type','in', ('payable', 'receivable', 'liquidity'))]}"/>
+                    </field>
+                </data>
+            </field>
+        </record>
+        <!-- End Accounts -->
+    </data>
+</openerp>

=== modified file 'l10n_cr_account_financial_report_webkit/report/account_bank_balances.mako'
--- l10n_cr_account_financial_report_webkit/report/account_bank_balances.mako	2012-06-13 20:01:31 +0000
+++ l10n_cr_account_financial_report_webkit/report/account_bank_balances.mako	2012-07-03 21:44:20 +0000
@@ -142,7 +142,7 @@
                 total_balance_curr = 0.0
                 total_inital_balance_curr = 0.0
             %>
-                %if currency[0] != None:
+                %if currency[0] != 'CRC':
                     <div class="account_title bg" style="margin-top: 20px; font-size: 12px; width: 700px;">${_('Account Bank Balance in ')} ${currency[0]}</div>
                 %else:
                     <div class="account_title bg" style="margin-top: 20px; font-size: 12px; width: 700px;">${_('Account Bank Balance in ')} ${company.currency_id.name}</div>
@@ -201,12 +201,12 @@
                         <%
                         move_lines = get_move_lines_account(cr, uid, filter_type, filter_data, account)
 
-                        if currency[0] != None:
-                            debit = get_debit_account(cr, uid, move_lines, account.currency_id.name)
-                            credit = get_credit_account(cr, uid, move_lines, account.currency_id.name)
-                            deposit = get_deposit_account(cr, uid, move_lines, account.currency_id.name, account)
-                            tefs = get_tefs_account(cr, uid, move_lines, account.currency_id.name, account)
-                            checks = get_checks_account(cr, uid, move_lines, account.currency_id.name, account)
+                        if currency[0] != 'CRC':
+                            debit = get_debit_account(cr, uid, move_lines, account.report_currency_id.name)
+                            credit = get_credit_account(cr, uid, move_lines, account.report_currency_id.name)
+                            deposit = get_deposit_account(cr, uid, move_lines, account.report_currency_id.name, account)
+                            tefs = get_tefs_account(cr, uid, move_lines, account.report_currency_id.name, account)
+                            checks = get_checks_account(cr, uid, move_lines, account.report_currency_id.name, account)
                         else:
                             debit = get_debit_account(cr, uid, move_lines, company.currency_id.name)
                             credit = get_credit_account(cr, uid, move_lines, company.currency_id.name)
@@ -286,14 +286,14 @@
                     <div class="act_as_row labels"  style="font-weight: bold; font-size: 11x">
                         <div class="act_as_cell first_column">${_('Total')}</div>
                         <div class="act_as_cell">${' '}</div>
-                        %if currency[0] != None:
-                            <div class="act_as_cell amount">${account.currency_id.symbol}${formatLang(total_inital_balance_curr)}</div>
-                            <div class="act_as_cell amount">${account.currency_id.symbol}${formatLang(total_tefs_curr)}</div>
-                            <div class="act_as_cell amount">${account.currency_id.symbol}${formatLang(total_checks_curr)}</div>
-                            <div class="act_as_cell amount">${account.currency_id.symbol}${formatLang(total_deposit_curr)}</div>
-                            <div class="act_as_cell amount">${account.currency_id.symbol}${formatLang(total_debit_curr)}</div>
-                            <div class="act_as_cell amount">${account.currency_id.symbol}${formatLang(total_credit_curr)}</div>
-                            <div class="act_as_cell amount">${account.currency_id.symbol}${formatLang(total_balance_curr)}</div>
+                        %if currency[0] != 'CRC':
+                            <div class="act_as_cell amount">${account.report_currency_id.symbol}${formatLang(total_inital_balance_curr)}</div>
+                            <div class="act_as_cell amount">${account.report_currency_id.symbol}${formatLang(total_tefs_curr)}</div>
+                            <div class="act_as_cell amount">${account.report_currency_id.symbol}${formatLang(total_checks_curr)}</div>
+                            <div class="act_as_cell amount">${account.report_currency_id.symbol}${formatLang(total_deposit_curr)}</div>
+                            <div class="act_as_cell amount">${account.report_currency_id.symbol}${formatLang(total_debit_curr)}</div>
+                            <div class="act_as_cell amount">${account.report_currency_id.symbol}${formatLang(total_credit_curr)}</div>
+                            <div class="act_as_cell amount">${account.report_currency_id.symbol}${formatLang(total_balance_curr)}</div>
                         %else:
                             <div class="act_as_cell amount">${company.currency_id.symbol}${formatLang(total_inital_balance_curr)}</div>
                             <div class="act_as_cell amount">${company.currency_id.symbol}${formatLang(total_tefs_curr)}</div>

=== modified file 'l10n_cr_account_financial_report_webkit/report/account_bank_balances.py'
--- l10n_cr_account_financial_report_webkit/report/account_bank_balances.py	2012-06-13 20:01:31 +0000
+++ l10n_cr_account_financial_report_webkit/report/account_bank_balances.py	2012-07-03 21:44:20 +0000
@@ -64,14 +64,14 @@
         all_accounts_by_currency = []
 
         for current_account in accounts:
-            current_name = current_account.currency_id.name
+            current_name = current_account.report_currency_id.name
             if current_name not in currency_names_list:
                 currency_names_list.append(current_name)
 
         for current_name in currency_names_list:
             account_currency = []
             for current_account in accounts:
-                if current_account.currency_id.name == current_name:
+                if current_account.report_currency_id.name == current_name:
                     account_currency.append(current_account)
             accounts_for_currency.append(account_currency)
 

=== modified file 'l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako'
--- l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako	2012-06-21 23:21:28 +0000
+++ l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako	2012-07-03 21:44:20 +0000
@@ -70,7 +70,7 @@
         account_by_curr = get_accounts_by_curr(cr, uid, objects)
         %>
         %for currency in account_by_curr:
-            %if currency[0] != None:
+            %if currency[0] != 'CRC':
                 <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 1080px;">${_('Accounts in ')} ${currency[0]}</div>
 		    %else:
                 <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 1080px;">${_('Accounts in ')} ${company.currency_id.name}</div>
@@ -89,7 +89,7 @@
                     account_balance_cumul_curr = 0.0
                     %>
 
-                    <div class="account_title bg" style="width: 1080px; margin-top: 15px; font-size: 12px;">${account.code} - ${account.name} - ${account.currency_id.name or account.company_id.currency_id.name}</div>
+                    <div class="account_title bg" style="width: 1080px; margin-top: 15px; font-size: 12px;">${account.code} - ${account.name} - ${account.report_currency_id.name or account.company_id.currency_id.name}</div>
                     
                     %for partner_name, p_id, p_ref, p_name in account.partners_order:
                     <%
@@ -300,7 +300,7 @@
                               <div class="act_as_cell">${_('Saldo')}</div>
                               ## reconcile
                               <!--div class="act_as_cell"></div-->
-                              %if currency[0] != None:
+                              %if currency[0] != 'CRC':
                                   <% currency_symbol = get_currency_symbol(cr, uid, last_line_currency) %>
                                    ## invoice
                                   <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_invoice) }</div>
@@ -330,13 +330,13 @@
                               %endif
                               %if amount_currency(data):
                                   ## currency balance
-                                  %if account.currency_id:
+                                  %if account.report_currency_id:
                                       <!--div class="act_as_cell amount sep_left">${formatLang(cumul_balance_curr) | amount }</div-->
                                   %else:
                                       <div class="act_as_cell sep_left amount">${ u'-' }</div>
                                   %endif
                                   ## currency code
-                                  <div class="act_as_cell" style="text-align: right; padding-right: 1px;">${ account.currency_id.name if account.currency_id else u'' }</div>
+                                  <div class="act_as_cell" style="text-align: right; padding-right: 1px;">${ account.report_currency_id.name if account.report_currency_id else u'' }</div>
                               %endif
                           </div>
                         </div>
@@ -357,7 +357,7 @@
                                 <div class="act_as_cell first_column" style="width: 300px;">${account.code} - ${account.name}</div>
                                 ## label
                                 <div class="act_as_cell" style="width: 302px;">${_("Saldo")}</div>
-                                %if currency[0] != None:
+                                %if currency[0] != 'CRC':
                                     ## invoice
                                     <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_invoice) }</div>
                                     ## payment
@@ -386,13 +386,13 @@
                                 %endif
                                 %if amount_currency(data):
                                     ## currency balance
-                                    %if account.currency_id:
+                                    %if account.report_currency_id:
                                         <!--div class="act_as_cell amount sep_left" style="width: 80px;">${ formatLang(account_balance_cumul_curr) | amount }</div-->
                                     %else:
                                         <div class="act_as_cell amount sep_left" style="width: 80px;">${ u'-' }</div>
                                     %endif
                                     ## curency code
-                                    <div class="act_as_cell amount" style="width: 30px; text-align: right; padding-right: 1px;">${ account.currency_id.name if account.currency_id else u'' }</div>
+                                    <div class="act_as_cell amount" style="width: 30px; text-align: right; padding-right: 1px;">${ account.report_currency_id.name if account.report_currency_id else u'' }</div>
                                 %endif
                             </div>
                         </div>

=== modified file 'l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako'
--- l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako	2012-07-02 19:53:18 +0000
+++ l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako	2012-07-03 21:44:20 +0000
@@ -82,7 +82,7 @@
         account_by_curr = get_accounts_by_curr(cr, uid, objects)
         %>
         %for currency in account_by_curr:
-            %if currency[0] != None:
+            %if currency[0] != 'CRC':
                 <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 1080px;">${_('Accounts in ')} ${currency[0]}</div>
 		    %else:
                 <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 1080px;">${_('Accounts in ')} ${company.currency_id.name}</div>
@@ -101,7 +101,7 @@
                     account_balance_accumulated_curr = 0.0
                     %>
 
-                    <div class="account_title bg" style="width: 1080px; margin-top: 15px; font-size: 12px;">${account.code} - ${account.name} - ${account.currency_id.name or account.company_id.currency_id.name}</div>
+                    <div class="account_title bg" style="width: 1080px; margin-top: 15px; font-size: 12px;">${account.code} - ${account.name} - ${account.report_currency_id.name or account.company_id.currency_id.name}</div>
                     
                     %for partner_name, p_id, p_ref, p_name in account.partners_order:
                     <%
@@ -119,12 +119,13 @@
                       partner_accumulated_balance = account.init_balance.get(p_id, {}).get('init_balance') or 0.0
                       init_balance = 0.0
                       init_balance = get_initial_balance(cr, uid, p_id, account, filter_type, filter_data, fiscal_year, currency[0])
+                      accumulated_balance = init_balance
                     %>
                     <div class="act_as_table list_table" style="margin-top: 5px;">
                         <div class="act_as_caption account_title">
                             ${ get_partner_name(cr, uid, partner_name, p_id, p_ref, p_name)  or _('No Partner')}<br />
-                            %if (currency[0] != None):
-                                <% currency_symbol = get_currency_symbol(cr, uid, account.currency_id.id) %>
+                            %if (currency[0] != 'CRC'):
+                                <% currency_symbol = get_currency_symbol(cr, uid, account.report_currency_id.id) %>
                             %else:
                                 <% currency_symbol = get_currency_symbol(cr, uid, company.currency_id.id) %>
                             %endif
@@ -289,7 +290,7 @@
                                   %endif
                                   </div>
                                   ## balance cumulated
-                                  <% accumulated_balance = (init_balance+invoice_amount+payment_amount+credit_amount+debit_amount+MM_amount) or 0.0 %>
+                                  <% accumulated_balance = (invoice_amount+payment_amount+credit_amount+debit_amount+MM_amount) or 0.0 %>
                                   <div class="act_as_cell amount" style="padding-right: 1px;">${formatLang(accumulated_balance) }</div>
                                   %if amount_currency(data):
                                       ## currency balance
@@ -304,6 +305,11 @@
                               total_accumulated_balance += accumulated_balance
                               %>
                             %endfor
+                            %if init_balance != 0.0:
+                            <%
+                                total_accumulated_balance += init_balance
+                            %>
+                            %endif
                             <div class="act_as_row lines labels">
                               ## date
                               <div class="act_as_cell first_column"></div>
@@ -319,7 +325,7 @@
                               <div class="act_as_cell">${_('Saldo')}</div>
                               ## reconcile
                               <!--div class="act_as_cell"></div-->
-                              %if currency[0] != None:
+                              %if currency[0] != 'CRC':
                                   <% currency_symbol = get_currency_symbol(cr, uid, last_line_currency) %>
                                    ## invoice
                                   <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_invoice) }</div>
@@ -349,13 +355,13 @@
                               %endif
                               %if amount_currency(data):
                                   ## currency balance
-                                  %if account.currency_id:
+                                  %if account.report_currency_id:
                                       <!--div class="act_as_cell amount sep_left">${formatLang(accumulated_balance_curr) | amount }</div-->
                                   %else:
                                       <div class="act_as_cell sep_left amount">${ u'-' }</div>
                                   %endif
                                   ## currency code
-                                  <div class="act_as_cell" style="text-align: right; padding-right: 1px;">${ account.currency_id.name if account.currency_id else u'' }</div>
+                                  <div class="act_as_cell" style="text-align: right; padding-right: 1px;">${ account.report_currency_id.name if account.report_currency_id else u'' }</div>
                               %endif
                           </div>
                         </div>
@@ -376,7 +382,7 @@
                                 <div class="act_as_cell first_column" style="width: 300px;">${account.code} - ${account.name}</div>
                                 ## label
                                 <div class="act_as_cell" style="width: 302px;">${_("Saldo")}</div>
-                                %if currency[0] != None:
+                                %if currency[0] != 'CRC':
                                     ## invoice
                                     <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_invoice) }</div>
                                     ## payment
@@ -405,13 +411,13 @@
                                 %endif
                                 %if amount_currency(data):
                                     ## currency balance
-                                    %if account.currency_id:
+                                    %if account.report_currency_id:
                                         <!--div class="act_as_cell amount sep_left" style="width: 80px;">${ formatLang(account_balance_accumulated_curr) | amount }</div-->
                                     %else:
                                         <div class="act_as_cell amount sep_left" style="width: 80px;">${ u'-' }</div>
                                     %endif
                                     ## curency code
-                                    <div class="act_as_cell amount" style="width: 30px; text-align: right; padding-right: 1px;">${ account.currency_id.name if account.currency_id else u'' }</div>
+                                    <div class="act_as_cell amount" style="width: 30px; text-align: right; padding-right: 1px;">${ account.report_currency_id.name if account.report_currency_id else u'' }</div>
                                 %endif
                             </div>
                         </div>

=== modified file 'l10n_cr_account_financial_report_webkit/report/l10n_cr_partners_ledger.py'
--- l10n_cr_account_financial_report_webkit/report/l10n_cr_partners_ledger.py	2012-07-02 18:36:28 +0000
+++ l10n_cr_account_financial_report_webkit/report/l10n_cr_partners_ledger.py	2012-07-03 21:44:20 +0000
@@ -52,14 +52,14 @@
         accounts_by_curr = []
 
         for account in objects:
-            currency_name = account.currency_id.name
+            currency_name = account.report_currency_id.name
             if currency_name not in currency_names_list:
                 currency_names_list.append(currency_name)
 
         for currency_name in currency_names_list:
             account_by_curr = []
             for account in objects:
-                if account.currency_id.name == currency_name:
+                if account.report_currency_id.name == currency_name:
                     account_by_curr.append(account)
             accounts_curr_list.append(account_by_curr)
 
@@ -90,7 +90,7 @@
         res = ('none', 0.0, 0.0)
 
         amount = 0.0
-        if currency != None:
+        if currency != 'CRC':
             amount = account_move_line['amount_currency']
         else:
             if account_move_line['debit'] != 0.0 :
@@ -163,7 +163,7 @@
         
         amount = 0.0
         for move_line in move_lines:
-            if currency != None:
+            if currency != 'CRC':
                 amount = move_line.amount_currency
             else:
                 if move_line.debit != 0.0 :


Follow ups