clearcorp team mailing list archive
-
clearcorp team
-
Mailing list archive
-
Message #00182
lp:~as.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_financial_report_webkit into lp:openerp-costa-rica/6.1
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/6.1.
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/111518
[FIX] Accounts grouped by Currency
[FIX] Open Invoices Report and Partner Ledger Report fixed
--
https://code.launchpad.net/~as.clearcorp/openerp-costa-rica/6.1-l10n_cr_account_financial_report_webkit/+merge/111518
Your team CLEARCORP development team is subscribed to branch lp:openerp-costa-rica/6.1.
=== 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-05 19:51:03 +0000
+++ l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako 2012-06-21 23:25:46 +0000
@@ -8,13 +8,6 @@
white-space: nowrap;
}
- .open_invoice_previous_line {
- font-style: italic;
- }
-
- .clearance_line {
- font-style: italic;
- }
${css}
</style>
</head>
@@ -26,6 +19,10 @@
<%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>
@@ -37,10 +34,9 @@
${_('Periods Filter')}
%endif
</div>
- <div class="act_as_cell">${_('Clearance Date')}</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>
@@ -59,7 +55,6 @@
${stop_period.name if stop_period else u'' }
%endif
</div>
- <div class="act_as_cell">${ formatLang(date_until, date=True) }</div>
<div class="act_as_cell">
%if partner_ids:
${_('Custom Filter')}
@@ -68,182 +63,342 @@
%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 account in objects:
- %if account.ledger_lines:
- <%
- if not account.partners_order:
- continue
- account_total_debit = 0.0
- account_total_credit = 0.0
- account_balance_cumul = 0.0
- account_balance_cumul_curr = 0.0
- %>
-
- <div class="account_title bg" style="width: 1080px; margin-top: 20px; font-size: 12px;">${account.code} - ${account.name}</div>
-
- %for partner_name, p_id, p_ref, p_name in account.partners_order:
- <%
- total_debit = 0.0
- total_credit = 0.0
- cumul_balance = 0.0
- cumul_balance_curr = 0.0
- %>
- <div class="act_as_table list_table" style="margin-top: 5px;">
- <div class="act_as_caption account_title">
- ${partner_name or _('No Partner')}
- </div>
- <div class="act_as_thead">
- <div class="act_as_row labels">
- ## date
- <div class="act_as_cell first_column" style="width: 60px;">${_('Date')}</div>
- ## period
- <div class="act_as_cell" style="width: 70px;">${_('Period')}</div>
- ## move
- <div class="act_as_cell" style="width: 70px;">${_('Entry')}</div>
- ## journal
- <div class="act_as_cell" style="width: 70px;">${_('Journal')}</div>
- ## partner
- <div class="act_as_cell" style="width: 60px;">${_('Partner')}</div>
- ## label
- <div class="act_as_cell" style="width: 255px;">${_('Label')}</div>
- ## reconcile
- <div class="act_as_cell" style="width: 80px;">${_('Rec.')}</div>
- ## maturity
- <div class="act_as_cell" style="width: 60px;">${_('Due Date')}</div>
- ## debit
- <div class="act_as_cell amount" style="width: 80px;">${_('Debit')}</div>
- ## credit
- <div class="act_as_cell amount" style="width: 80px;">${_('Credit')}</div>
- ## balance cumulated
- <div class="act_as_cell amount" style="width: 80px;">${_('Cumul. Bal.')}</div>
- %if amount_currency(data):
- ## currency balance
- <div class="act_as_cell amount sep_left" style="width: 80px;">${_('Curr. Balance')}</div>
- ## curency code
- <div class="act_as_cell amount" style="width: 30px; text-align: right;">${_('Curr.')}</div>
- %endif
- </div>
- </div>
- <div class="act_as_tbody">
- <%
- total_debit = 0.0
- total_credit = 0.0
- %>
-
- %for line in account.ledger_lines.get(p_id, []):
- <%
- total_debit += line.get('debit') or 0.0
- total_credit += line.get('credit') or 0.0
- cumul_balance += line.get('balance') or 0.0
- cumul_balance_curr += line.get('amount_currency') or 0.0
-
- label_elements = [line.get('lname') or '']
- if line.get('invoice_number'):
- label_elements.append("(%s)" % (line['invoice_number'],))
- label = ' '.join(label_elements)
- %>
- <div class="act_as_row lines ${line.get('is_from_previous_periods') and 'open_invoice_previous_line' or ''} ${line.get('is_clearance_line') and 'clearance_line' or ''}">
+ <%
+ account_by_curr = get_accounts_by_curr(cr, uid, objects)
+ %>
+ %for currency in account_by_curr:
+ %if currency[0] != None:
+ <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>
+ %endif
+ %for account in currency[1]:
+ %if account.ledger_lines or account.init_balance:
+ <%
+ if not account.partners_order:
+ continue
+ account_total_invoice = 0.0
+ account_total_payment = 0.0
+ account_total_debit = 0.0
+ account_total_credit = 0.0
+ account_total_manual_move = 0.0
+ account_balance_cumul = 0.0
+ 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>
+
+ %for partner_name, p_id, p_ref, p_name in account.partners_order:
+ <%
+ total_invoice = 0.0
+ total_payment = 0.0
+ total_debit = 0.0
+ total_credit = 0.0
+ total_manual_move = 0.0
+ cumul_balance = 0.0
+ cumul_balance_curr = 0.0
+
+ part_cumul_balance = 0.0
+ part_cumul_balance_curr = 0.0
+ %>
+ <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')}
+ </div>
+ <div class="act_as_thead">
+ <div class="act_as_row labels">
+ ## date
+ <div class="act_as_cell first_column" style="width: 50px;">${_('Date')}</div>
+ ## period
+ <div class="act_as_cell" style="width: 70px;">${_('Period')}</div>
+ ## move
+ <div class="act_as_cell" style="width: 70px;">${_('Entry')}</div>
+ ## journal
+ <div class="act_as_cell" style="width: 70px;">${_('Journal')}</div>
+ ## partner
+ <!--div class="act_as_cell" style="width: 60px;">${_('Partner')}</div-->
+ ## label
+ <div class="act_as_cell" style="width: 270px;">${_('Label')}</div>
+ ## reconcile
+ <div class="act_as_cell" style="width: 70px;">${_('Rec.')}</div>
+ ## Invoices
+ <div class="act_as_cell amount" style="width: 100px;">${_('Invoice')}</div>
+ ## credit
+ <div class="act_as_cell amount" style="width: 100px;">${_('Payments')}</div>
+ ## debit
+ <div class="act_as_cell amount" style="width: 100px;">${_('Credit')}</div>
+ ## Payments
+ <div class="act_as_cell amount" style="width: 100px;">${_('Debit')}</div>
+ ## Manual Move
+ <div class="act_as_cell amount" style="width: 115px;">${_('Manual Move')}</div>
+ ## balance cumulated
+ <div class="act_as_cell amount" style="width: 115px;">${_('Cumul. Bal.')}</div>
+ %if amount_currency(data):
+ ## currency balance
+ <div class="act_as_cell amount sep_left" style="width: 80px;">${_('Curr. Balance')}</div>
+ ## curency code
+ <div class="act_as_cell amount" style="width: 30px; text-align: right;">${_('Curr.')}</div>
+ %endif
+ </div>
+ </div>
+ <div class="act_as_tbody">
+ <!--<%
+ #total_debit = account.init_balance.get(p_id, {}).get('debit') or 0.0
+ #total_credit = account.init_balance.get(p_id, {}).get('credit') or 0.0
+ total_cumul_balance = 0.0
+ %>-->
+ %if initial_balance_mode and (total_debit or total_credit):
+ <%
+ #part_cumul_balance = account.init_balance.get(p_id, {}).get('init_balance') or 0.0
+ #part_cumul_balance_curr = account.init_balance.get(p_id, {}).get('init_balance_currency') or 0.0
+ #balance_forward_currency = account.init_balance.get(p_id, {}).get('currency_name') or ''
+
+ #cumul_balance += part_cumul_balance
+ #cumul_balance_curr += part_cumul_balance_curr
+ %>
+ %endif
+
+
+ %for line in account.ledger_lines.get(p_id, []):
+ <%open = is_open(cr, uid, line)%>
+ %if open:
+ <%
+ label_elements = [line.get('lname') or '']
+ if line.get('invoice_number'):
+ label_elements.append("(%s)" % (line['invoice_number'],))
+ label = ' '.join(label_elements)
+
+ invoice_amount = 0.0
+ payment_amount = 0.0
+ credit_amount = 0.0
+ debit_amount = 0.0
+ MM_amount = 0.0
+
+ amount = get_amount(cr, uid, line, currency[0])
+ %>
+ <div class="act_as_row lines">
+ ## date
+ <div class="act_as_cell first_column">${formatLang(line.get('ldate') or '', date=True)}</div>
+ ## period
+ <div class="act_as_cell">${line.get('period_code') or ''}</div>
+ ## move
+ <div class="act_as_cell">${line.get('move_name') or ''}</div>
+ ## journal
+ <div class="act_as_cell">${line.get('jcode') or ''}</div>
+ ## partner
+ <!--div class="act_as_cell overflow_ellipsis">${line.get('partner_name') or ''}</div-->
+ ## label
+ <div class="act_as_cell">${label}</div>
+ ## reconcile
+ <div class="act_as_cell">${line.get('rec_name') or ''}</div>
+ ## Invoice
+ <div class="act_as_cell amount">
+ %if amount[0] == 'invoice':
+ <%
+ invoice_amount = amount[1]
+ total_invoice += invoice_amount
+ %>
+ ${ formatLang(invoice_amount or 0.0) }
+ %else:
+ ${'0.0'}
+ %endif
+ %if amount[2] != None and amount[0] == 'invoice':
+ ${' ('}${ formatLang(amount[2]) }${')'}
+ %endif
+ </div>
+ ## Payment
+ <div class="act_as_cell amount">
+ %if amount[0] == 'payment':
+ <%
+ payment_amount = amount[1]
+ total_payment += payment_amount
+ %>
+ ${ formatLang(payment_amount or 0.0) }
+ %else:
+ ${'0.0'}
+ %endif
+ %if amount[2] != None and amount[0] == 'payment':
+ ${' ('}${ formatLang(amount[2]) }${')'}
+ %endif
+ </div>
+ ## Credit
+ <div class="act_as_cell amount">
+ %if amount[0] == 'credit':
+ <%
+ credit_amount = amount[1]
+ total_credit += credit_amount
+ %>
+ ${ formatLang(credit_amount or 0.0) }
+ %else:
+ ${'0.0'}
+ %endif
+ %if amount[2] != None and amount[0] == 'credit':
+ ${' ('}${ formatLang(amount[2]) }${')'}
+ %endif
+ </div>
+ ## Debit
+ <div class="act_as_cell amount">
+ %if amount[0] == 'debit':
+ <%
+ debit_amount = amount[1]
+ total_debit += debit_amount
+ %>
+ ${ formatLang(debit_amount or 0.0) }
+ %else:
+ ${'0.0'}
+ %endif
+ %if amount[2] != None and amount[0] == 'debit':
+ ${' ('}${ formatLang(amount[2]) }${')'}
+ %endif
+ </div>
+ ## Manual move
+ <div class="act_as_cell amount">
+ %if amount[0] == 'manual':
+ <%
+ MM_amount = amount[1]
+ total_manual_move += MM_amount
+ %>
+ ${ formatLang(MM_amount or 0.0) }
+ %else:
+ ${'0.0'}
+ %endif
+ %if amount[2] != None and amount[0] == 'manual':
+ ${' ('}${ formatLang(amount[2]) }${')'}
+ %endif
+ </div>
+ ## balance cumulated
+ <% cumul_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(cumul_balance) }</div>
+ %if amount_currency(data):
+ ## currency balance
+ <div class="act_as_cell sep_left amount">${formatLang(line.get('amount_currency') or 0.0) }</div>
+ ## curency code
+ <div class="act_as_cell" style="text-align: right; ">${line.get('currency_code') or ''}</div>
+ %endif
+ <% last_line_currency = line.get('currency_id') %>
+ </div>
+ <%
+ total_cumul_balance = total_invoice + total_payment + total_debit + total_credit + total_manual_move
+ %>
+ %endif
+ %endfor
+ <div class="act_as_row lines labels">
## date
- <div class="act_as_cell first_column">${formatLang(line.get('ldate') or '', date=True)}</div>
+ <div class="act_as_cell first_column"></div>
## period
- <div class="act_as_cell">${line.get('period_code') or ''}</div>
+ <div class="act_as_cell"></div>
## move
- <div class="act_as_cell">${line.get('move_name') or ''}</div>
+ <div class="act_as_cell"></div>
## journal
- <div class="act_as_cell">${line.get('jcode') or ''}</div>
+ <div class="act_as_cell"></div>
## partner
- <div class="act_as_cell overflow_ellipsis">${line.get('partner_name') or ''}</div>
+ <div class="act_as_cell"></div>
## label
- <div class="act_as_cell">${label}</div>
+ <div class="act_as_cell">${_('Saldo')}</div>
## reconcile
- <div class="act_as_cell">${line.get('rec_name') or ''}</div>
- ## maturity date
- <div class="act_as_cell">${formatLang(line.get('date_maturity') or '', date=True)}</div>
- ## debit
- <div class="act_as_cell amount">${formatLang(line.get('debit') or 0.0) | amount }</div>
- ## credit
- <div class="act_as_cell amount">${formatLang(line.get('credit') or 0.0) | amount }</div>
- ## balance cumulated
- <div class="act_as_cell amount" style="padding-right: 1px;">${formatLang(line.get('balance') or 0.0) | amount }</div>
+ <!--div class="act_as_cell"></div-->
+ %if currency[0] != None:
+ <% currency_symbol = get_currency_symbol(cr, uid, last_line_currency) %>
+ ## invoice
+ <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_invoice) }</div>
+ ## payment
+ <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_payment) }</div>
+ ## credit
+ <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_credit) }</div>
+ ## debit
+ <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_debit) }</div>
+ ## manual move
+ <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_manual_move) }</div>
+ ## balance cumulated
+ <div class="act_as_cell amount" style="padding-right: 1px;">${currency_symbol} ${formatLang(total_cumul_balance) }</div>
+ %else:
+ ## invoice
+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_invoice) }</div>
+ ## payment
+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_payment) }</div>
+ ## credit
+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_credit) }</div>
+ ## debit
+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_debit) }</div>
+ ## manual move
+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_manual_move) }</div>
+ ## balance cumulated
+ <div class="act_as_cell amount" style="padding-right: 1px;">${company.currency_id.symbol} ${formatLang(total_cumul_balance) }</div>
+ %endif
%if amount_currency(data):
## currency balance
- <div class="act_as_cell sep_left amount">${formatLang(line.get('amount_currency') or 0.0) | amount }</div>
- ## curency code
- <div class="act_as_cell" style="text-align: right; ">${line.get('currency_code') or ''}</div>
+ %if account.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>
%endif
</div>
- %endfor
- <div class="act_as_row lines labels">
- ## date
- <div class="act_as_cell first_column"></div>
- ## period
- <div class="act_as_cell"></div>
- ## move
- <div class="act_as_cell"></div>
- ## journal
- <div class="act_as_cell"></div>
- ## partner
- <div class="act_as_cell"></div>
- ## label
- <div class="act_as_cell">${_('Cumulated Balance on Partner')}</div>
- ## reconcile
- <div class="act_as_cell"></div>
- ## maturity date
- <div class="act_as_cell"></div>
- ## debit
- <div class="act_as_cell amount">${formatLang(total_debit) | amount }</div>
- ## credit
- <div class="act_as_cell amount">${formatLang(total_credit) | amount }</div>
- ## balance cumulated
- <div class="act_as_cell amount" style="padding-right: 1px;">${formatLang(cumul_balance) | amount }</div>
- %if amount_currency(data):
- %if account.currency_id:
- ## currency balance
- <div class="act_as_cell sep_left amount" style="padding-right: 1px;">${formatLang(cumul_balance_curr) | amount }</div>
- %else:
- <div class="act_as_cell sep_left amount" style="padding-right: 1px;">${ u'-' }</div>
- %endif
- ## curency code
- <div class="act_as_cell" style="text-align: right; ">${ account.currency_id.name if account.currency_id else u'' }</div>
- %endif
- </div>
+ </div>
</div>
- </div>
- <%
- account_total_debit += total_debit
- account_total_credit += total_credit
- account_balance_cumul += cumul_balance
- account_balance_cumul_curr += cumul_balance_curr
- %>
- %endfor
- <div class="act_as_table list_table" style="margin-top:5px;">
- <div class="act_as_row labels" style="font-weight: bold; font-size: 12px;">
- <div class="act_as_cell first_column" style="width: 330px;">${account.code} - ${account.name}</div>
- ## label
- <div class="act_as_cell" style="width: 395px;">${_("Cumulated Balance on Account")}</div>
- ## debit
- <div class="act_as_cell amount" style="width: 80px;">${ formatLang(account_total_debit) | amount }</div>
- ## credit
- <div class="act_as_cell amount" style="width: 80px;">${ formatLang(account_total_credit) | amount }</div>
- ## balance cumulated
- <div class="act_as_cell amount" style="width: 80px; ">${ formatLang(account_balance_cumul) | amount }</div>
- %if amount_currency(data):
- ## currency balance cumulated
- %if account.currency_id:
- <div class="act_as_cell amount sep_left" style="width: 80px;">${ formatLang(account_balance_cumul_curr) | amount }</div>
+ <%
+ account_total_invoice += total_invoice
+ account_total_payment += total_payment
+ account_total_debit += total_debit
+ account_total_credit += total_credit
+ account_total_manual_move += total_manual_move
+ account_balance_cumul += total_cumul_balance
+ account_balance_cumul_curr += account_balance_cumul
+ %>
+ %endfor
+
+ <div class="act_as_table list_table" style="margin-top:5px;">
+ <div class="act_as_row labels" style="font-weight: bold; font-size: 12px;">
+ <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:
+ ## invoice
+ <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_invoice) }</div>
+ ## payment
+ <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_payment) }</div>
+ ## credit
+ <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_credit) }</div>
+ ## debit
+ <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_debit) }</div>
+ ## manual move
+ <div class="act_as_cell amount" style="width: 115px;">${currency_symbol} ${ formatLang(account_total_manual_move) }</div>
+ ## balance cumulated
+ <div class="act_as_cell amount" style="width: 115px; padding-right: 1px;">${currency_symbol} ${ formatLang(account_balance_cumul) }</div>
%else:
- <div class="act_as_cell amount sep_left" style="width: 80px; padding-right: 1px;">${ u'-' }</div>
- %endif
- ## curency code
- <div class="act_as_cell amount" style="width: 30px; text-align: right;">${ account.currency_id.name if account.currency_id else u'' }</div>
- %endif
+ ## invoice
+ <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_invoice) }</div>
+ ## payment
+ <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_payment) }</div>
+ ## credit
+ <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_credit) }</div>
+ ## debit
+ <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_debit) }</div>
+ ## manual move
+ <div class="act_as_cell amount" style="width: 115px;">${company.currency_id.symbol} ${ formatLang(account_total_manual_move) }</div>
+ ## balance cumulated
+ <div class="act_as_cell amount" style="width: 115px; padding-right: 1px;">${company.currency_id.symbol} ${ formatLang(account_balance_cumul) }</div>
+ %endif
+ %if amount_currency(data):
+ ## currency balance
+ %if account.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>
+ %endif
+ </div>
</div>
</div>
- </div>
- %endif
+ %endif
+ %endfor
%endfor
</body>
</html>
=== 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-06-05 19:51:03 +0000
+++ l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako 2012-06-21 23:25:46 +0000
@@ -66,92 +66,223 @@
<div class="act_as_cell">${ initial_balance_text[initial_balance_mode] }</div>
</div>
</div>
-
- %for account in objects:
- %if account.ledger_lines or account.init_balance:
- <%
- if not account.partners_order:
- continue
- account_total_invoice = 0.0
- account_total_payment = 0.0
- account_total_debit = 0.0
- account_total_credit = 0.0
- account_total_manual_move = 0.0
- account_balance_cumul = 0.0
- account_balance_cumul_curr = 0.0
- %>
-
- <div class="account_title bg" style="width: 1080px; margin-top: 20px; font-size: 12px;">${account.code} - ${account.name} - ${account.currency_id.name or account.company_id.currency_id.name}</div>
-
- %for partner_name, p_id, p_ref, p_name in account.partners_order:
- <%
- total_invoice = 0.0
- total_payment = 0.0
- total_debit = 0.0
- total_credit = 0.0
- total_manual_move = 0.0
- cumul_balance = 0.0
- cumul_balance_curr = 0.0
-
- part_cumul_balance = 0.0
- part_cumul_balance_curr = 0.0
- %>
- <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')}
- </div>
- <div class="act_as_thead">
- <div class="act_as_row labels">
- ## date
- <div class="act_as_cell first_column" style="width: 50px;">${_('Date')}</div>
- ## period
- <div class="act_as_cell" style="width: 70px;">${_('Period')}</div>
- ## move
- <div class="act_as_cell" style="width: 70px;">${_('Entry')}</div>
- ## journal
- <div class="act_as_cell" style="width: 70px;">${_('Journal')}</div>
- ## partner
- <!--div class="act_as_cell" style="width: 60px;">${_('Partner')}</div-->
- ## label
- <div class="act_as_cell" style="width: 310px;">${_('Label')}</div>
- ## reconcile
- <div class="act_as_cell" style="width: 80px;">${_('Rec.')}</div>
- ## Invoices
- <div class="act_as_cell amount" style="width: 80px;">${_('Invoice')}</div>
- ## credit
- <div class="act_as_cell amount" style="width: 80px;">${_('Payments')}</div>
- ## debit
- <div class="act_as_cell amount" style="width: 80px;">${_('Credit')}</div>
- ## Payments
- <div class="act_as_cell amount" style="width: 80px;">${_('Debit')}</div>
- ## Manual Move
- <div class="act_as_cell amount" style="width: 80px;">${_('Manual Move')}</div>
- ## balance cumulated
- <div class="act_as_cell amount" style="width: 80px;">${_('Cumul. Bal.')}</div>
- %if amount_currency(data):
- ## currency balance
- <div class="act_as_cell amount sep_left" style="width: 80px;">${_('Curr. Balance')}</div>
- ## curency code
- <div class="act_as_cell amount" style="width: 30px; text-align: right;">${_('Curr.')}</div>
- %endif
- </div>
- </div>
- <div class="act_as_tbody">
- <!--<%
- #total_debit = account.init_balance.get(p_id, {}).get('debit') or 0.0
- #total_credit = account.init_balance.get(p_id, {}).get('credit') or 0.0
- total_cumul_balance = 0.0
- %>-->
- %if initial_balance_mode and (total_debit or total_credit):
- <%
- #part_cumul_balance = account.init_balance.get(p_id, {}).get('init_balance') or 0.0
- #part_cumul_balance_curr = account.init_balance.get(p_id, {}).get('init_balance_currency') or 0.0
- #balance_forward_currency = account.init_balance.get(p_id, {}).get('currency_name') or ''
-
- #cumul_balance += part_cumul_balance
- #cumul_balance_curr += part_cumul_balance_curr
- %>
- <!--div class="act_as_row initial_balance">
+ <%
+ account_by_curr = get_accounts_by_curr(cr, uid, objects)
+ %>
+ %for currency in account_by_curr:
+ %if currency[0] != None:
+ <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>
+ %endif
+ %for account in currency[1]:
+ %if account.ledger_lines or account.init_balance:
+ <%
+ if not account.partners_order:
+ continue
+ account_total_invoice = 0.0
+ account_total_payment = 0.0
+ account_total_debit = 0.0
+ account_total_credit = 0.0
+ account_total_manual_move = 0.0
+ account_balance_cumul = 0.0
+ 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>
+
+ %for partner_name, p_id, p_ref, p_name in account.partners_order:
+ <%
+ total_invoice = 0.0
+ total_payment = 0.0
+ total_debit = 0.0
+ total_credit = 0.0
+ total_manual_move = 0.0
+ cumul_balance = 0.0
+ cumul_balance_curr = 0.0
+
+ part_cumul_balance = 0.0
+ part_cumul_balance_curr = 0.0
+ %>
+ <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')}
+ </div>
+ <div class="act_as_thead">
+ <div class="act_as_row labels">
+ ## date
+ <div class="act_as_cell first_column" style="width: 50px;">${_('Date')}</div>
+ ## period
+ <div class="act_as_cell" style="width: 70px;">${_('Period')}</div>
+ ## move
+ <div class="act_as_cell" style="width: 70px;">${_('Entry')}</div>
+ ## journal
+ <div class="act_as_cell" style="width: 70px;">${_('Journal')}</div>
+ ## partner
+ <!--div class="act_as_cell" style="width: 60px;">${_('Partner')}</div-->
+ ## label
+ <div class="act_as_cell" style="width: 270px;">${_('Label')}</div>
+ ## reconcile
+ <div class="act_as_cell" style="width: 70px;">${_('Rec.')}</div>
+ ## Invoices
+ <div class="act_as_cell amount" style="width: 100px;">${_('Invoice')}</div>
+ ## credit
+ <div class="act_as_cell amount" style="width: 100px;">${_('Payments')}</div>
+ ## debit
+ <div class="act_as_cell amount" style="width: 100px;">${_('Credit')}</div>
+ ## Payments
+ <div class="act_as_cell amount" style="width: 100px;">${_('Debit')}</div>
+ ## Manual Move
+ <div class="act_as_cell amount" style="width: 115px;">${_('Manual Move')}</div>
+ ## balance cumulated
+ <div class="act_as_cell amount" style="width: 115px;">${_('Cumul. Bal.')}</div>
+ %if amount_currency(data):
+ ## currency balance
+ <div class="act_as_cell amount sep_left" style="width: 80px;">${_('Curr. Balance')}</div>
+ ## curency code
+ <div class="act_as_cell amount" style="width: 30px; text-align: right;">${_('Curr.')}</div>
+ %endif
+ </div>
+ </div>
+ <div class="act_as_tbody">
+ <!--<%
+ #total_debit = account.init_balance.get(p_id, {}).get('debit') or 0.0
+ #total_credit = account.init_balance.get(p_id, {}).get('credit') or 0.0
+ total_cumul_balance = 0.0
+ %>-->
+ %if initial_balance_mode and (total_debit or total_credit):
+ <%
+ #part_cumul_balance = account.init_balance.get(p_id, {}).get('init_balance') or 0.0
+ #part_cumul_balance_curr = account.init_balance.get(p_id, {}).get('init_balance_currency') or 0.0
+ #balance_forward_currency = account.init_balance.get(p_id, {}).get('currency_name') or ''
+
+ #cumul_balance += part_cumul_balance
+ #cumul_balance_curr += part_cumul_balance_curr
+ %>
+ %endif
+
+
+ %for line in account.ledger_lines.get(p_id, []):
+ <%
+ label_elements = [line.get('lname') or '']
+ if line.get('invoice_number'):
+ label_elements.append("(%s)" % (line['invoice_number'],))
+ label = ' '.join(label_elements)
+
+ invoice_amount = 0.0
+ payment_amount = 0.0
+ credit_amount = 0.0
+ debit_amount = 0.0
+ MM_amount = 0.0
+
+ amount = get_amount(cr, uid, line, currency[0])
+ %>
+ <div class="act_as_row lines">
+ ## date
+ <div class="act_as_cell first_column">${formatLang(line.get('ldate') or '', date=True)}</div>
+ ## period
+ <div class="act_as_cell">${line.get('period_code') or ''}</div>
+ ## move
+ <div class="act_as_cell">${line.get('move_name') or ''}</div>
+ ## journal
+ <div class="act_as_cell">${line.get('jcode') or ''}</div>
+ ## partner
+ <!--div class="act_as_cell overflow_ellipsis">${line.get('partner_name') or ''}</div-->
+ ## label
+ <div class="act_as_cell">${label}</div>
+ ## reconcile
+ <div class="act_as_cell">${line.get('rec_name') or ''}</div>
+ ## Invoice
+ <div class="act_as_cell amount">
+ %if amount[0] == 'invoice':
+ <%
+ invoice_amount = amount[1]
+ total_invoice += invoice_amount
+ %>
+ ${ formatLang(invoice_amount or 0.0) }
+ %else:
+ ${'0.0'}
+ %endif
+ %if amount[2] != None and amount[0] == 'invoice':
+ ${' ('}${ formatLang(amount[2]) }${')'}
+ %endif
+ </div>
+ ## Payment
+ <div class="act_as_cell amount">
+ %if amount[0] == 'payment':
+ <%
+ payment_amount = amount[1]
+ total_payment += payment_amount
+ %>
+ ${ formatLang(payment_amount or 0.0) }
+ %else:
+ ${'0.0'}
+ %endif
+ %if amount[2] != None and amount[0] == 'payment':
+ ${' ('}${ formatLang(amount[2]) }${')'}
+ %endif
+ </div>
+ ## Credit
+ <div class="act_as_cell amount">
+ %if amount[0] == 'credit':
+ <%
+ credit_amount = amount[1]
+ total_credit += credit_amount
+ %>
+ ${ formatLang(credit_amount or 0.0) }
+ %else:
+ ${'0.0'}
+ %endif
+ %if amount[2] != None and amount[0] == 'credit':
+ ${' ('}${ formatLang(amount[2]) }${')'}
+ %endif
+ </div>
+ ## Debit
+ <div class="act_as_cell amount">
+ %if amount[0] == 'debit':
+ <%
+ debit_amount = amount[1]
+ total_debit += debit_amount
+ %>
+ ${ formatLang(debit_amount or 0.0) }
+ %else:
+ ${'0.0'}
+ %endif
+ %if amount[2] != None and amount[0] == 'debit':
+ ${' ('}${ formatLang(amount[2]) }${')'}
+ %endif
+ </div>
+ ## Manual move
+ <div class="act_as_cell amount">
+ %if amount[0] == 'manual':
+ <%
+ MM_amount = amount[1]
+ total_manual_move += MM_amount
+ %>
+ ${ formatLang(MM_amount or 0.0) }
+ %else:
+ ${'0.0'}
+ %endif
+ %if amount[2] != None and amount[0] == 'manual':
+ ${' ('}${ formatLang(amount[2]) }${')'}
+ %endif
+ </div>
+ ## balance cumulated
+ <% cumul_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(cumul_balance) }</div>
+ %if amount_currency(data):
+ ## currency balance
+ <div class="act_as_cell sep_left amount">${formatLang(line.get('amount_currency') or 0.0) }</div>
+ ## curency code
+ <div class="act_as_cell" style="text-align: right; ">${line.get('currency_code') or ''}</div>
+ %endif
+ <% last_line_currency = line.get('currency_id') %>
+ </div>
+ <%
+ total_cumul_balance = total_invoice + total_payment + total_debit + total_credit + total_manual_move
+ %>
+ %endfor
+ <div class="act_as_row lines labels">
## date
<div class="act_as_cell first_column"></div>
## period
@@ -163,167 +294,108 @@
## partner
<div class="act_as_cell"></div>
## label
- <div class="act_as_cell" >${_('Initial Balance')}</div>
- ## reconcile
- <div class="act_as_cell"></div>
- ## Invoice
- <div class="act_as_cell"></div>
- ## payment
- <div class="act_as_cell"></div>
- ## debit
- <div class="act_as_cell amount">${formatLang(total_debit) | amount }</div>
- ## credit
- <div class="act_as_cell amount">${formatLang(total_credit) | amount }</div>
- ## balance cumulated
- <div class="act_as_cell amount" style="padding-right: 1px;">${formatLang(part_cumul_balance) | amount }</div>
- %if amount_currency(data):
- ## currency balance
- <div class="act_as_cell sep_left amount">${formatLang(part_cumul_balance_curr) | amount }</div>
- ## curency code
- <div class="act_as_cell">${balance_forward_currency}</div>
- %endif
-
- </div-->
- %endif
-
- %for line in account.ledger_lines.get(p_id, []):
- <%
- total_invoice += get_amount(cr, uid, line,'invoice') or 0.0
- total_payment += get_amount(cr, uid, line,'payment') or 0.0
- total_debit += get_amount(cr, uid, line,'debit') or 0.0
- total_credit += get_amount(cr, uid, line,'credit') or 0.0
- total_manual_move += get_amount(cr, uid, line,'move') or 0.0
- total_cumul_balance2 = total_invoice + total_payment + total_debit + total_credit + total_manual_move
- total_cumul_balance = total_cumul_balance2
-
- label_elements = [line.get('lname') or '']
- if line.get('invoice_number'):
- label_elements.append("(%s)" % (line['invoice_number'],))
- label = ' '.join(label_elements)
- %>
- <div class="act_as_row lines">
- ## date
- <div class="act_as_cell first_column">${formatLang(line.get('ldate') or '', date=True)}</div>
- ## period
- <div class="act_as_cell">${line.get('period_code') or ''}</div>
- ## move
- <div class="act_as_cell">${line.get('move_name') or ''}</div>
- ## journal
- <div class="act_as_cell">${line.get('jcode') or ''}</div>
- ## partner
- <!--div class="act_as_cell overflow_ellipsis">${line.get('partner_name') or ''}</div-->
- ## label
- <div class="act_as_cell">${label}</div>
- ## reconcile
- <div class="act_as_cell">${line.get('rec_name') or ''}</div>
- ## Invoice
- <% invoice_amount = get_amount(cr, uid, line,'invoice')%>
- <div class="act_as_cell amount">${ formatLang(invoice_amount or 0.0) | amount }</div>
- ## Payment
- <% payment_amount = get_amount(cr, uid, line,'payment')%>
- <div class="act_as_cell amount">${formatLang(payment_amount or 0.0) | amount }</div>
- ## Credit
- <% credit_amount = get_amount(cr, uid, line,'credit')%>
- <div class="act_as_cell amount">${formatLang(credit_amount or 0.0) | amount }</div>
- ## Debit
- <% debit_amount = get_amount(cr, uid, line,'debit')%>
- <div class="act_as_cell amount">${formatLang(debit_amount or 0.0) | amount }</div>
- ## Manual move
- <% MM_amount = get_amount(cr, uid, line,'move')%>
- <div class="act_as_cell amount">${formatLang(MM_amount or 0.0) | amount }</div>
- ## balance cumulated
- <% cumul_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(cumul_balance) | amount }</div>
+ <div class="act_as_cell">${_('Saldo')}</div>
+ ## reconcile
+ <!--div class="act_as_cell"></div-->
+ %if currency[0] != None:
+ <% currency_symbol = get_currency_symbol(cr, uid, last_line_currency) %>
+ ## invoice
+ <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_invoice) }</div>
+ ## payment
+ <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_payment) }</div>
+ ## credit
+ <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_credit) }</div>
+ ## debit
+ <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_debit) }</div>
+ ## manual move
+ <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_manual_move) }</div>
+ ## balance cumulated
+ <div class="act_as_cell amount" style="padding-right: 1px;">${currency_symbol} ${formatLang(total_cumul_balance) }</div>
+ %else:
+ ## invoice
+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_invoice) }</div>
+ ## payment
+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_payment) }</div>
+ ## credit
+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_credit) }</div>
+ ## debit
+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_debit) }</div>
+ ## manual move
+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_manual_move) }</div>
+ ## balance cumulated
+ <div class="act_as_cell amount" style="padding-right: 1px;">${company.currency_id.symbol} ${formatLang(total_cumul_balance) }</div>
+ %endif
%if amount_currency(data):
## currency balance
- <div class="act_as_cell sep_left amount">${formatLang(line.get('amount_currency') or 0.0) | amount }</div>
- ## curency code
- <div class="act_as_cell" style="text-align: right; ">${line.get('currency_code') or ''}</div>
+ %if account.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>
%endif
</div>
- %endfor
- <div class="act_as_row lines labels">
- ## date
- <div class="act_as_cell first_column"></div>
- ## period
- <div class="act_as_cell"></div>
- ## move
- <div class="act_as_cell"></div>
- ## journal
- <div class="act_as_cell"></div>
- ## partner
- <div class="act_as_cell"></div>
- ## label
- <div class="act_as_cell">${_('Saldo')}</div>
- ## reconcile
- <!--div class="act_as_cell"></div-->
- ## invoice
- <div class="act_as_cell amount">${formatLang(total_invoice) | amount }</div>
- ## payment
- <div class="act_as_cell amount">${formatLang(total_payment) | amount }</div>
- ## credit
- <div class="act_as_cell amount">${formatLang(total_credit) | amount }</div>
- ## debit
- <div class="act_as_cell amount">${formatLang(total_debit) | amount }</div>
- ## manual move
- <div class="act_as_cell amount">${formatLang(total_manual_move) | amount }</div>
- ## balance cumulated
- <div class="act_as_cell amount" style="padding-right: 1px;">${formatLang(total_cumul_balance) | amount }</div>
- %if amount_currency(data):
- ## currency balance
- %if account.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>
- %endif
- </div>
+ </div>
</div>
- </div>
- <%
- account_total_invoice += total_invoice
- account_total_payment += total_payment
- account_total_debit += total_debit
- account_total_credit += total_credit
- account_total_manual_move += total_manual_move
- account_balance_cumul += total_cumul_balance
- account_balance_cumul_curr += account_balance_cumul
- %>
- %endfor
+ <%
+ account_total_invoice += total_invoice
+ account_total_payment += total_payment
+ account_total_debit += total_debit
+ account_total_credit += total_credit
+ account_total_manual_move += total_manual_move
+ account_balance_cumul += total_cumul_balance
+ account_balance_cumul_curr += account_balance_cumul
+ %>
+ %endfor
- <div class="act_as_table list_table" style="margin-top:5px;">
- <div class="act_as_row labels" style="font-weight: bold; font-size: 12px;">
- <div class="act_as_cell first_column" style="width: 320px;">${account.code} - ${account.name}</div>
- ## label
- <div class="act_as_cell" style="width: 330px;">${_("Saldo")}</div>
- ## invoice
- <div class="act_as_cell amount" style="width: 80px;">${ formatLang(account_total_invoice) | amount }</div>
- ## payment
- <div class="act_as_cell amount" style="width: 80px;">${ formatLang(account_total_payment) | amount }</div>
- ## credit
- <div class="act_as_cell amount" style="width: 80px;">${ formatLang(account_total_credit) | amount }</div>
- ## debit
- <div class="act_as_cell amount" style="width: 80px;">${ formatLang(account_total_debit) | amount }</div>
- ## manual move
- <div class="act_as_cell amount" style="width: 80px;">${ formatLang(account_total_manual_move) | amount }</div>
- ## balance cumulated
- <div class="act_as_cell amount" style="width: 80px; padding-right: 1px;">${ formatLang(account_balance_cumul) | amount }</div>
- %if amount_currency(data):
- ## currency balance
- %if account.currency_id:
- <!--div class="act_as_cell amount sep_left" style="width: 80px;">${ formatLang(account_balance_cumul_curr) | amount }</div-->
+ <div class="act_as_table list_table" style="margin-top:5px;">
+ <div class="act_as_row labels" style="font-weight: bold; font-size: 12px;">
+ <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:
+ ## invoice
+ <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_invoice) }</div>
+ ## payment
+ <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_payment) }</div>
+ ## credit
+ <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_credit) }</div>
+ ## debit
+ <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_debit) }</div>
+ ## manual move
+ <div class="act_as_cell amount" style="width: 115px;">${currency_symbol} ${ formatLang(account_total_manual_move) }</div>
+ ## balance cumulated
+ <div class="act_as_cell amount" style="width: 115px; padding-right: 1px;">${currency_symbol} ${ formatLang(account_balance_cumul) }</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>
- %endif
+ ## invoice
+ <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_invoice) }</div>
+ ## payment
+ <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_payment) }</div>
+ ## credit
+ <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_credit) }</div>
+ ## debit
+ <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_debit) }</div>
+ ## manual move
+ <div class="act_as_cell amount" style="width: 115px;">${company.currency_id.symbol} ${ formatLang(account_total_manual_move) }</div>
+ ## balance cumulated
+ <div class="act_as_cell amount" style="width: 115px; padding-right: 1px;">${company.currency_id.symbol} ${ formatLang(account_balance_cumul) }</div>
+ %endif
+ %if amount_currency(data):
+ ## currency balance
+ %if account.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>
+ %endif
+ </div>
</div>
</div>
- </div>
- %endif
+ %endif
+ %endfor
%endfor
</body>
</html>
=== modified file 'l10n_cr_account_financial_report_webkit/report/l10n_cr_open_invoices.py'
--- l10n_cr_account_financial_report_webkit/report/l10n_cr_open_invoices.py 2012-06-05 20:10:55 +0000
+++ l10n_cr_account_financial_report_webkit/report/l10n_cr_open_invoices.py 2012-06-21 23:25:46 +0000
@@ -35,17 +35,44 @@
from openerp.addons.report_webkit import report_helper
import addons
-from openerp.addons.account_financial_report_webkit.report.open_invoices import PartnersOpenInvoicesWebkit
+from l10n_cr_partners_ledger import l10n_cr_PartnersLedgerWebkit
from openerp.addons.account_financial_report_webkit.report.webkit_parser_header_fix import HeaderFooterTextWebKitParser
-class l10n_cr_PartnersOpenInvoicesWebkit(PartnersOpenInvoicesWebkit):
+class l10n_cr_PartnersOpenInvoicesWebkit(l10n_cr_PartnersLedgerWebkit):
def __init__(self, cursor, uid, name, context):
super(l10n_cr_PartnersOpenInvoicesWebkit, self).__init__(cursor, uid, name, context=context)
self.pool = pooler.get_pool(self.cr.dbname)
self.cursor = self.cr
-
+ company = self.pool.get('res.users').browse(self.cr, uid, uid, context=context).company_id
+ header_report_name = ' - '.join((_('OPEN INVOICES REPORT'), company.name, company.currency_id.name))
+
+ footer_date_time = self.formatLang(str(datetime.today()), date_time=True)
+
+ self.localcontext.update({
+ 'is_open': self.is_open,
+ 'report_name':_('Open Invoices Report'),
+ 'additional_args': [
+ ('--header-font-name', 'Helvetica'),
+ ('--footer-font-name', 'Helvetica'),
+ ('--header-font-size', '10'),
+ ('--footer-font-size', '6'),
+ ('--header-left', header_report_name),
+ ('--header-spacing', '2'),
+ ('--footer-left', footer_date_time),
+ ('--footer-right', ' '.join((_('Page'), '[page]', _('of'), '[topage]'))),
+ ('--footer-line',),
+ ],
+ })
+
+ def is_open(self,cr, uid, account_move_line):
+ move_line_obj = self.pool.get('account.move.line').browse(cr,uid,account_move_line['id'])
+
+ if move_line_obj.reconcile_id.id == False:
+ return True
+ else:
+ return False
HeaderFooterTextWebKitParser('report.account_financial_report_webkit.account.account_report_open_invoices_webkit',
'account.account',
=== 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-06-05 19:51:03 +0000
+++ l10n_cr_account_financial_report_webkit/report/l10n_cr_partners_ledger.py 2012-06-21 23:25:46 +0000
@@ -41,10 +41,36 @@
self.localcontext.update({
'get_amount': self.get_amount,
'get_partner_name': self.get_partner_name,
+ 'get_accounts_by_curr': self.get_accounts_by_curr,
+ 'get_currency_symbol': self.get_currency_symbol,
})
- def get_amount(self,cr, uid, account_move_line,field):
- move_line_obj = self.pool.get('account.move.line').browse(cr,uid,account_move_line['id'])
+ def get_accounts_by_curr(self, cr, uid, objects):
+ currency_names_list = []
+ accounts_curr_list = []
+ accounts_by_curr = []
+
+ for account in objects:
+ currency_name = account.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:
+ account_by_curr.append(account)
+ accounts_curr_list.append(account_by_curr)
+
+ i = 0
+ for currency_name in currency_names_list:
+ temp_tup = (currency_name, accounts_curr_list[i])
+ accounts_by_curr.append(temp_tup)
+ i += 1
+
+ return accounts_by_curr
+
+ def get_amount(self,cr, uid, account_move_line, currency):
account_obj = self.pool.get('account.account').browse(cr,uid,account_move_line['account_id'])
obj_invoice = self.pool.get('account.invoice')
@@ -53,302 +79,52 @@
if invoice_search != []:
invoice = obj_invoice.browse(cr,uid,invoice_search[0])
- #invoice = account_move_line.invoice
-
obj_voucher = self.pool.get('account.voucher')
voucher_search = obj_voucher.search(cr,uid,[('move_id','=',account_move_line['move_id'])])
+
voucher = None
if voucher_search != []:
voucher = obj_voucher.browse(cr,uid,voucher_search[0])
-
- result_empty = 0.0
-
- if account_obj.type == 'receivable': #CxC
- amount_debit_sign = 1
- amount_credit_sign = 1
-
- if invoice:
- if invoice.type == 'out_invoice': # Customer Invoice
- if not account_obj.currency_id :
- if field == 'invoice':
- res = amount_debit_sign * account_move_line['debit']
- else:
- res = result_empty
- else:
- if field == 'invoice':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif invoice.type == 'in_invoice': # Supplier Invoice
- if not account_obj.currency_id :
- if field == 'invoice':
- res = amount_debit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'invoice':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif invoice.type == 'out_refund': # Nota de Credito Customer
- if not account_obj.currency_id :
- if field == 'credit':
- res = amount_credit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'credit':
- res = amount_credit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif invoice.type == 'in_refund': # Nota Debito Supplier
- if not account_obj.currency_id :
- if field == 'debit':
- res = amount_debit_sign * account_move_line['debit']
- else:
- res = result_empty
- else:
- if field == 'debit':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- else:
- res = result_empty
-
- elif voucher:
- if voucher.type == 'sale': #
- if not account_obj.currency_id :
- if field == 'invoice':
- res = amount_credit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'invoice':
- res = amount_credit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif voucher.type == 'payment': #
- if not account_obj.currency_id :
- if field == 'payment':
- res = amount_debit_sign * account_move_line['debit']
- else:
- res = result_empty
- else:
- if field == 'payment':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif voucher.type == 'purchase': #
- if not account_obj.currency_id :
- if field == 'debit':
- res = amount_debit_sign * account_move_line['debit']
- else:
- res = result_empty
- else:
- if field == 'debit':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif voucher.type == 'receipt': #
- if move_line_obj.reconcile_id or move_line_obj.reconcile_partial_id:
- if not account_obj.currency_id :
- if field == 'receipt':
- res = amount_credit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'receipt':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- else:
- if not account_obj.currency_id :
- if field == 'credit':
- res = amount_debit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'credit':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- else:
- res = result_empty
-
- else: # Manual Move
- if field == 'move':
- if not account_obj.currency_id :
- if account_move_line['credit'] != 0.0 :
- res = amount_credit_sign * account_move_line['credit']
- elif account_move_line['debit'] != 0.0 :
- res = amount_debit_sign * account_move_line['debit']
- else:
- res = result_empty
- else:
- if account_move_line['credit'] != 0.0 :
- res = amount_credit_sign * account_move_line['amount_currency']
- elif account_move_line['debit'] != 0.0 :
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
-
- elif account_obj.type == 'payable': #CxP
- amount_debit_sign = 1
- amount_credit_sign = -1
-
- if invoice:
- if invoice.type == 'out_invoice': # Customer Invoice
- if not account_obj.currency_id :
- if field == 'invoice':
- res = amount_debit_sign * account_move_line['debit']
- else:
- res = result_empty
- else:
- if field == 'invoice':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif invoice.type == 'in_invoice': # Supplier Invoice
- if not account_obj.currency_id :
- if field == 'invoice':
- res = amount_debit_sign * account_move_line['debit']
- else:
- res = result_empty
- else:
- if field == 'invoice':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif invoice.type == 'out_refund': # Nota de Credito Customer
- if not account_obj.currency_id :
- if field == 'invoice':
- res = amount_debit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'invoice':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif invoice.type == 'in_refund': # Nota Debito Supplier
- if not account_obj.currency_id :
- if field == 'debit':
- res = amount_debit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'debit':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- else:
- res = result_empty
-
- elif voucher:
- if voucher.type == 'sale': #
- if not account_obj.currency_id :
- if field == 'invoice':
- res = amount_credit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'invoice':
- res = amount_credit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif voucher.type == 'payment': #
- if move_line_obj.reconcile_id or move_line_obj.reconcile_partial_id:
- if not account_obj.currency_id :
- if field == 'payment':
- res = amount_credit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'payment':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- else:
- if not account_obj.currency_id :
- if field == 'credit':
- res = amount_debit_sign * account_move_line['debit']
- else:
- res = result_empty
- else:
- if field == 'credit':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif voucher.type == 'purchase': #
- if invoice:
- if not account_obj.currency_id :
- if field == 'credit':
- res = amount_debit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'credit':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- else:
- if not account_obj.currency_id :
- if field == 'debit':
- res = amount_debit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'debit':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- elif voucher.type == 'receipt': #
- #if invoice:
- if not account_obj.currency_id :
- if field == 'payment':
- res = amount_debit_sign * account_move_line['credit']
- else:
- res = result_empty
- else:
- if field == 'payment':
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
- #else:
- #if not account_obj.currency_id :
- #if field == 'credit':
- #res = amount_debit_sign * account_move_line['credit']
- #else:
- #res = result_empty
- #else:
- #if field == 'credit':
- #res = amount_debit_sign * account_move_line['amount_currency']
- #else:
- #res = result_empty
- else:
- res = result_empty
-
- else: # Manual Move
- if field == 'move':
- if not account_obj.currency_id :
- if account_move_line['credit'] != 0.0 :
- res = amount_credit_sign * account_move_line['credit']
- elif account_move_line['debit'] != 0.0 :
- res = amount_debit_sign * account_move_line['debit']
- else:
- res = result_empty
- else:
- if account_move_line['credit'] != 0.0 :
- res = amount_credit_sign * account_move_line['amount_currency']
- elif account_move_line['debit'] != 0.0 :
- res = amount_debit_sign * account_move_line['amount_currency']
- else:
- res = result_empty
-
-
-
-
-
+
+ res = ('none', 0.0, 0.0)
+
+ amount = 0.0
+ if currency != None:
+ amount = account_move_line['amount_currency']
+ else:
+ if account_move_line['debit'] != 0.0 :
+ amount = account_move_line['debit']
+ elif account_move_line['credit'] != 0.0 :
+ amount = account_move_line['credit'] * -1
+
+ # Invoices
+ if invoice:
+ if invoice.type == 'out_invoice': # Customer Invoice
+ res = ('invoice', amount)
+ elif invoice.type == 'in_invoice': # Supplier Invoice
+ res = ('invoice', amount)
+ elif invoice.type == 'in_refund': # Debit Note
+ res = ('debit', amount)
+ elif invoice.type == 'out_refund': # Credit Note
+ res = ('credit', amount)
+ # Vouchers
+ elif voucher:
+ if voucher.type == 'payment': # Payment
+ res = ('payment', amount)
+ elif voucher.type == 'sale': # Invoice
+ res = ('invoice', amount)
+ elif voucher.type == 'receipt': # Payment
+ res = ('payment', amount)
+ # Manual Move
+ else:
+ res = ('manual', amount)
+
+ if res[1] == None or (currency != None and res[1] == 0.0):
+ secundary_amount = (account_move_line['debit'] != 0.0) and account_move_line['debit'] or account_move_line['credit']
+ res = (res[0], 0.0, secundary_amount)
+ else:
+ res = (res[0], res[1], None)
+
return res
def get_partner_name(self,cr,uid,partner_name, p_id, p_ref, p_name):
@@ -362,6 +138,11 @@
return res
+ def get_currency_symbol(self, cr, uid, currency_id):
+ currency = self.pool.get('res.currency').browse(cr,uid,currency_id)
+
+ return currency.symbol
+
HeaderFooterTextWebKitParser('report.account_financial_report_webkit.account.account_report_partners_ledger_webkit',
'account.account',
'addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako',
Follow ups