Browse Source

[IMP] Open Invoices - Generic informations and calculation of totals for partner and account

pull/196/head
Francesco Apruzzese 9 years ago
committed by Leonardo Pistone
parent
commit
51a7cdc5ac
  1. 48
      account_financial_report_qweb/report/templates/open_invoice_report.xml
  2. 29
      account_financial_report_qweb/wizard/open_invoice_wizard.py

48
account_financial_report_qweb/report/templates/open_invoice_report.xml

@ -36,28 +36,32 @@
<table class="table table-bordered table-condensed" style="text-align: center;">
<thead>
<tr style="background-color:#e3e3e3;">
<th>Chart of Account</th>
<th>Company</th>
<th>Fiscal Year</th>
<th>Period Filters</th>
<th>At Date</th>
<th>Accounts Filter</th>
<th>Target Moves</th>
<th>Initial Balance</th>
</tr>
</thead>
<tbody>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><span t-esc="general['company']"/></td>
<td><span t-esc="general['fiscal_year']"/></td>
<td><span t-esc="general['at_date']"/></td>
<td><span t-esc="general['account_filters']"/></td>
<td><span t-esc="general['target_moves']"/></td>
</tbody>
</table>
<br/>
</div>
<t t-foreach="data" t-as="account">
<p><strong><span t-esc="account"/></strong></p>
<t t-foreach="data[account]" t-as="partner">
<t t-set="account_debit" t-value="0.0" />
<t t-set="account_credit" t-value="0.0" />
<t t-set="account_balance" t-value="0.0" />
<p><strong><span t-esc="account"/></strong></p>
<t t-foreach="data[account]" t-as="partner">
<t t-set="partner_debit" t-value="0.0" />
<t t-set="partner_credit" t-value="0.0" />
<t t-set="partner_balance" t-value="0.0" />
<p><strong><span t-esc="partner"/></strong></p>
<table class="table table-bordered table-condensed">
<thead>
@ -87,26 +91,32 @@
<td><span t-esc="move['label']"/></td>
<td><span t-esc="move['rec']"/></td>
<td><span t-esc="move['due_date']"/></td>
<t t-set="account_debit" t-value="account_debit + move['debit']" />
<t t-set="account_credit" t-value="account_credit + move['credit']" />
<t t-set="account_balance" t-value="account_balance - move['credit'] + move['debit']" />
<t t-set="partner_debit" t-value="partner_debit + move['debit']" />
<t t-set="partner_credit" t-value="partner_credit + move['credit']" />
<t t-set="partner_balance" t-value="partner_balance - move['credit'] + move['debit']" />
<td class="text-right"><span t-esc="move['debit']"/></td>
<td class="text-right"><span t-esc="move['credit']"/></td>
<td class="text-right"><span t-esc="move['balance']"/></td>
<td class="text-right"><span t-esc="partner_balance" /></td>
</tr>
<tr>
<td colspan="6"></td>
<td colspan="3">Comulate Balance on Partner</td>
<td class="text-right">0</td>
<td class="text-right">0</td>
<td class="text-right">0</td>
<td class="text-right"><span t-esc="partner_debit" /></td>
<td class="text-right"><span t-esc="partner_credit" /></td>
<td class="text-right"><span t-esc="partner_balance" /></td>
</tr>
</tbody>
</table>
</t>
<table class="table table-bordered table-condensed">
<tbody><tr><h2>
<tbody><tr>
<td colspan="9"><strong><span t-esc="account"/> Comulate Balance</strong></td>
<td class="text-right" style="width:8%">0</td>
<td class="text-right" style="width:8%">0</td>
<td class="text-right" style="width:8%">0</td></h2></tr>
<td class="text-right" style="width:8%"><span t-esc="account_debit" /></td>
<td class="text-right" style="width:8%"><span t-esc="account_credit" /></td>
<td class="text-right" style="width:8%"><span t-esc="account_balance" /></td></tr>
</tbody>
</table>
<br/>

29
account_financial_report_qweb/wizard/open_invoice_wizard.py

@ -66,6 +66,7 @@ class OpenInvoiceWizard(models.TransientModel):
elif data['result_selection'] == 'supplier':
account_type = ('payable', )
domain = [
('reconciled', '=', False),
('company_id', '=', data['company_id'].id),
('move_id.date', '<=', data['at_date']),
('account_id.user_type_id.type', 'in', account_type)
@ -79,20 +80,22 @@ class OpenInvoiceWizard(models.TransientModel):
return domain
@staticmethod
def _get_moves_data(move):
def _get_move_line_data(move):
label = move.name
if move.invoice_id:
label = '{label} ({inv_nummber})'.format(
label=label, inv_nummber=move.invoice_id.number)
return {
'date': move.date,
'period': '',
'entry': move.move_id.name,
'journal': move.move_id.journal_id.code,
'reference': move.ref,
'label': '{move_line_name} ({move_ref})'.format(
move_line_name=move.name, move_ref=move.move_id.ref),
'label': label,
'rec': move.full_reconcile_id.name,
'due_date': move.date_maturity,
'debit': move.debit or '',
'credit': move.credit or '',
'balance': '',
'debit': move.debit,
'credit': move.credit,
}
@api.multi
@ -108,7 +111,17 @@ class OpenInvoiceWizard(models.TransientModel):
if move.partner_id.name not in datas[move.account_id.name]:
datas[move.account_id.name][move.partner_id.name] = []
datas[move.account_id.name][move.partner_id.name].append(
self._get_moves_data(move))
self._get_move_line_data(move))
generals = {
'company': self.company_id.name,
'fiscal_year': '',
'at_date': self.at_date,
'account_filters': dict(
self._columns['result_selection'].selection)[
self.result_selection],
'target_moves': dict(
self._columns['target_move'].selection)[self.target_move],
}
return self.env['report'].with_context(landscape=True).get_action(
self, 'account_financial_report_qweb.open_invoice_report_qweb',
data={'data': datas})
data={'data': datas, 'general': generals})
Loading…
Cancel
Save