← Back to team overview

clearcorp team mailing list archive

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

 

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

Requested reviews:
  CLEARCORP drivers (clearcorp-drivers)

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

[ADD] Add totals for init_balance, debit, credit and balance for trial balance report
-- 
https://code.launchpad.net/~dr.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_financial_report_webkit_balance_comprobacion/+merge/132795
Your team CLEARCORP development team is subscribed to branch lp:openerp-costa-rica.
=== modified file 'l10n_cr_account_financial_report_webkit/report/__init__.py'
--- l10n_cr_account_financial_report_webkit/report/__init__.py	2012-07-20 16:00:33 +0000
+++ l10n_cr_account_financial_report_webkit/report/__init__.py	2012-11-04 02:37:20 +0000
@@ -3,3 +3,5 @@
 import l10n_cr_partner_balance
 import account_bank_balances
 import l10n_cr_account_financial_report
+import l10n_cr_account_report_trial_balance
+

=== added file 'l10n_cr_account_financial_report_webkit/report/account_report_trial_balance.mako'
--- l10n_cr_account_financial_report_webkit/report/account_report_trial_balance.mako	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_financial_report_webkit/report/account_report_trial_balance.mako	2012-11-04 02:37:20 +0000
@@ -0,0 +1,270 @@
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+    <head>
+        <style type="text/css">
+            .account_level_1 {
+                text-transform: uppercase;
+                font-size: 15px;
+                background-color:#F0F0F0;
+            }
+
+            .account_level_2 {
+                font-size: 12px;
+                background-color:#F0F0F0;
+            }
+
+            .regular_account_type {
+                font-weight: normal;
+            }
+
+            .view_account_type {
+                font-weight: bold;
+            }
+
+            .account_level_consol {
+                font-weight: normal;
+            	font-style: italic;
+            }
+
+            ${css}
+
+            .list_table .act_as_row {
+                margin-top: 10px;
+                margin-bottom: 10px;
+                font-size:10px;
+            }
+        </style>
+    </head>
+    
+    <body>
+        <%
+        def amount(text):
+            return text.replace('-', '&#8209;')  # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers)
+        %>
+
+        <%setLang(user.context_lang)%>
+
+        <%
+        initial_balance_text = {'initial_balance': _('Computed'), 'opening_balance': _('Opening Entries'), False: _('No')}
+        %>
+
+        <div class="act_as_table data_table">
+            <div class="act_as_row labels">
+                <div class="act_as_cell">${_('Chart of Account')}</div>
+                <div class="act_as_cell">${_('Fiscal Year')}</div>
+                <div class="act_as_cell">
+                    %if filter_form(data) == 'filter_date':
+                        ${_('Dates Filter')}
+                    %else:
+                        ${_('Periods Filter')}
+                    %endif
+                </div>
+                <div class="act_as_cell">${_('Accounts Filter')}</div>
+                <div class="act_as_cell">${_('Target Moves')}</div>
+                <div class="act_as_cell">${_('Initial Balance')}</div>
+            </div>
+            <div class="act_as_row">
+                <div class="act_as_cell">${ chart_account.name }</div>
+                <div class="act_as_cell">${ fiscalyear.name if fiscalyear else '-' }</div>
+                <div class="act_as_cell">
+                    ${_('From:')}
+                    %if filter_form(data) == 'filter_date':
+                        ${formatLang(start_date, date=True) if start_date else u'' }
+                    %else:
+                        ${start_period.name if start_period else u''}
+                    %endif
+                    ${_('To:')}
+                    %if filter_form(data) == 'filter_date':
+                        ${ formatLang(stop_date, date=True) if stop_date else u'' }
+                    %else:
+                        ${stop_period.name if stop_period else u'' }
+                    %endif
+                </div>
+                <div class="act_as_cell">
+                    %if accounts(data):
+                        ${', '.join([account.code for account in accounts(data)])}
+                    %else:
+                        ${_('All')}
+                    %endif
+                </div>
+                <div class="act_as_cell">${ display_target_move(data) }</div>
+                <div class="act_as_cell">${ initial_balance_text[initial_balance_mode] }</div>
+              </div>
+        </div>
+
+        %for index, params in enumerate(comp_params):
+            <div class="act_as_table data_table">
+                <div class="act_as_row">
+                    <div class="act_as_cell">${_('Comparison %s') % (index + 1,)} (${"C%s" % (index + 1,)})</div>
+                    <div class="act_as_cell">
+                        %if params['comparison_filter'] == 'filter_date':
+                            ${_('Dates Filter:')}&nbsp;${formatLang(params['start'], date=True) }&nbsp;-&nbsp;${formatLang(params['stop'], date=True) }
+                        %elif params['comparison_filter'] == 'filter_period':
+                            ${_('Periods Filter:')}&nbsp;${params['start'].name}&nbsp;-&nbsp;${params['stop'].name}
+                        %else:
+                            ${_('Fiscal Year :')}&nbsp;${params['fiscalyear'].name}
+                        %endif
+                    </div>
+                    <div class="act_as_cell">${_('Initial Balance:')} ${ initial_balance_text[params['initial_balance_mode']] }</div>
+                </div>
+            </div>
+        %endfor
+
+        <div class="act_as_table list_table" style="margin-top: 20px;">
+
+            <div class="act_as_thead">
+                <div class="act_as_row labels">
+                    ## code
+                    <div class="act_as_cell first_column" style="width: 20px;">${_('Code')}</div>
+                    ## account name
+                    <div class="act_as_cell" style="width: 80px;">${_('Account')}</div>
+                    %if comparison_mode == 'no_comparison':
+                        %if initial_balance_mode:
+                            ## initial balance
+                            <div class="act_as_cell amount" style="width: 30px;">${_('Initial Balance')}</div>
+                        %endif
+                        ## debit
+                        <div class="act_as_cell amount" style="width: 30px;">${_('Debit')}</div>
+                        ## credit
+                        <div class="act_as_cell amount" style="width: 30px;">${_('Credit')}</div>
+                    %endif
+                    ## balance
+                    <div class="act_as_cell amount" style="width: 30px;">
+                    %if comparison_mode == 'no_comparison' or not fiscalyear:
+                        ${_('Balance')}
+                    %else:
+                        ${_('Balance %s') % (fiscalyear.name,)}
+                    %endif
+                    </div>
+                    %if comparison_mode in ('single', 'multiple'):
+                        %for index in range(nb_comparison):
+                            <div class="act_as_cell amount" style="width: 30px;">
+                                %if comp_params[index]['comparison_filter'] == 'filter_year' and comp_params[index].get('fiscalyear', False):
+                                    ${_('Balance %s') % (comp_params[index]['fiscalyear'].name,)}
+                                %else:
+                                    ${_('Balance C%s') % (index + 1,)}
+                                %endif
+                            </div>
+                            %if comparison_mode == 'single':  ## no diff in multiple comparisons because it shows too data
+                                <div class="act_as_cell amount" style="width: 30px;">${_('Difference')}</div>
+                                <div class="act_as_cell amount" style="width: 30px;">${_('% Difference')}</div>
+                            %endif
+                        %endfor
+                    %endif
+                </div>
+            </div>
+
+            <div class="act_as_tbody">
+                <%
+                last_child_consol_ids = []
+                last_level = False
+                
+                init_balance = 0
+                debit = 0
+                credit = 0
+                balance = 0
+                                 
+                count = 0 
+                flag = False   
+                list = []        
+                %>
+               
+                %for current_account in objects:
+                    <%
+                        if not current_account.to_display:
+                            continue
+    
+                        comparisons = current_account.comparisons
+    
+                        if current_account.id in last_child_consol_ids:
+                            # current account is a consolidation child of the last account: use the level of last account
+                            level = last_level
+                            level_class = "account_level_consol"
+                            
+                        else:
+                            # current_account is a not a consolidation child: use its own level                         
+                            level = current_account.level or 0
+                            level_class = "account_level_%s" % (level,)
+                            last_child_consol_ids = [child_consol_id.id for child_consol_id in current_account.child_consol_ids]
+                            last_level = current_account.level  
+                    %>
+                    
+                    %if current_account.parent_id.parent_id.name is None and count > 0:
+                        <div class="act_as_row lines ${level_class} ${"%s_account_type" % (current_account.type,)}">                       
+                            <div class="act_as_cell first_column">  </div>
+                            <div class="act_as_cell" style="padding-left:5px;">TOTAL</div>
+                            <div class="act_as_cell amount">${formatLang(init_balance)}</div>   
+                            <div class="act_as_cell amount">${formatLang(debit)}</div>   
+                            <div class="act_as_cell amount">${formatLang(credit)}</div>   
+                            <div class="act_as_cell amount">${formatLang(balance)}</div>              
+                       </div>
+                       <%
+                            init_balance = 0
+                            debit = 0
+                            credit = 0
+                            balance = 0
+                       %>
+                    %endif                     
+                                    
+                    <div class="act_as_row lines ${level_class} ${"%s_account_type" % (current_account.type,)}">
+                         ## code                     
+                         <div class="act_as_cell first_column">${current_account.code}</div>
+                         ## account name
+                         <div class="act_as_cell" style="padding-left: ${level * 5}px;">${current_account.name}</div>                    
+                        
+                         %if comparison_mode == 'no_comparison':
+                            %if initial_balance_mode:
+                                ## opening balance
+                                <div class="act_as_cell amount">${formatLang(current_account.init_balance) | amount}</div>
+                            %endif
+                            ## debit
+                            <div class="act_as_cell amount">${formatLang(current_account.debit) | amount}</div>
+                            ## credit
+                            <div class="act_as_cell amount">${formatLang(current_account.credit) | amount}</div>
+                         %endif                        
+                         ## balance
+                         <div class="act_as_cell amount">${formatLang(current_account.balance) | amount}</div>
+
+                         %if comparison_mode in ('single', 'multiple'):
+                            %for comp_account in comparisons:
+                                <div class="act_as_cell amount">${formatLang(comp_account['balance']) | amount}</div>
+                                %if comparison_mode == 'single':  ## no diff in multiple comparisons because it shows too data
+                                    <div class="act_as_cell amount">${formatLang(comp_account['diff']) | amount}</div>
+                                    <div class="act_as_cell amount"> 
+                                    %if comp_account['percent_diff'] is False:
+                                     ${ '-' }
+                                    %else:
+                                       ${int(round(comp_account['percent_diff'])) | amount} &#37;
+                                    %endif
+                                    </div>
+                                %endif
+                            %endfor
+                         %endif                    
+                     </div>
+                     <% count += 1 %> 
+                     <%
+                        if (current_account.parent_id.parent_id.name is None):
+                            level_class = 1 
+                            init_balance += current_account.init_balance
+                            debit += current_account.debit
+                            credit += current_account.credit
+                            balance += current_account. balance                            
+                            #dic = {'init_balance': init_balance,}
+                            #list.append(current_account.id)
+                           
+                    %>        
+                %endfor          
+            </div>             
+            %if current_account.parent_id.parent_id.name is None and count > 0:
+                <div class="act_as_row lines ${level_class} ${"%s_account_type" % (current_account.type,)}">                       
+                    <div class="act_as_cell first_column">  </div>
+                    <div class="act_as_cell" style="padding-left:5px;">TOTAL</div>
+                    <div class="act_as_cell amount">${formatLang(init_balance)}</div>   
+                    <div class="act_as_cell amount">${formatLang(debit)}</div>   
+                    <div class="act_as_cell amount">${formatLang(credit)}</div>   
+                    <div class="act_as_cell amount">${formatLang(balance)}</div>              
+                </div>            
+            %endif 
+        </div>
+    </body>
+</html>

=== added file 'l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_trial_balance.py'
--- l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_trial_balance.py	1970-01-01 00:00:00 +0000
+++ l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_trial_balance.py	2012-11-04 02:37:20 +0000
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Addons modules by CLEARCORP S.A.
+#    Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+#    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 report import report_sxw
+from account_financial_report_webkit.report.common_reports import CommonReportHeaderWebkit
+from account.report.account_balance import account_balance
+
+class l10n_cr_account_report_trial_balance(report_sxw.rml_parse,CommonReportHeaderWebkit):
+
+    def __init__(self, cr, uid, name, context=None):
+        super(l10n_cr_account_report_trial_balance, self).__init__(cr, uid, name, context=context)
+        account_balance = account_balance(cr,uid,name,context=context)
+        
+        self.lines = account_balance.lines
+        self.localcontext.update({
+            'lines': self.lines,           
+        })
+        self.context = context
+
+#the parameters are the report name and module name 
+report_sxw.report_sxw( 'report.account_report_trial_balance_webkit', 
+                       'account.account',
+                       'addons/l10n_cr_account_financial_report_webkit/report/account_report_trial_balance.mako', 
+                        parser = l10n_cr_account_report_trial_balance)
+

=== modified file 'l10n_cr_account_financial_report_webkit/report/report.xml'
--- l10n_cr_account_financial_report_webkit/report/report.xml	2012-09-05 21:10:36 +0000
+++ l10n_cr_account_financial_report_webkit/report/report.xml	2012-11-04 02:37:20 +0000
@@ -64,7 +64,15 @@
              <field name="name">Account Financial Report</field>
              <field name="report_rml">l10n_cr_account_financial_report_webkit/report/l10n_cr_account_financial_report.mako</field>
              <field name="report_file">l10n_cr_account_financial_report_webkit/report/l10n_cr_account_financial_report.mako</field>
-         </record>
-       
+         </record>         
+              
+         <report auto="False"
+            id="account.account_report_trial_balance_webkit"
+            model="account.account"
+            name="account_report_trial_balance_webkit"
+            file="l10n_cr_account_financial_report_webkit/report/account_report_trial_balance.mako"
+            string="Trial Balance Webkit"
+            report_type="webkit"/>
+                            
     </data>
 </openerp>


Follow ups