Browse Source

[IMP] Fill open invoice report with informations keep from account move lines

pull/367/head
Francesco Apruzzese 9 years ago
committed by Jordi Ballester
parent
commit
0fe0cb06fa
  1. 1
      account_financial_report_qweb/report/__init__.py
  2. 19
      account_financial_report_qweb/report/open_invoice.py
  3. 41
      account_financial_report_qweb/report/templates/open_invoice_report.xml
  4. 62
      account_financial_report_qweb/wizard/open_invoice_wizard.py

1
account_financial_report_qweb/report/__init__.py

@ -4,3 +4,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from . import common
from . import general_ledger
from . import open_invoice

19
account_financial_report_qweb/report/open_invoice.py

@ -0,0 +1,19 @@
from openerp import models, api
class OpenInvoiceReport(models.AbstractModel):
_name = 'report.account_financial_report_qweb.open_invoice_report_qweb'
@api.multi
def render_html(self, data=None):
report_obj = self.env['report']
doc_ids = self._ids
docargs = {
'doc_model': 'account.move.line',
'doc_ids': doc_ids,
}
if data:
docargs.update(data)
return report_obj.render(
'account_financial_report_qweb.open_invoice_report_qweb',
docargs)

41
account_financial_report_qweb/report/templates/open_invoice_report.xml

@ -2,7 +2,7 @@
<openerp>
<data>
<template id="open_invoice_report_document">
<template id="open_invoice_report_qweb">
<style type="text/css">
td, th {
@ -59,11 +59,11 @@
<t t-call="report.html_container">
<t t-call="report.internal_layout">
<div class="page">
<t t-foreach="data" t-as="account">
<p><span t-esc="account" /></p>
<t t-foreach="data[account]" t-as="partner">
<p><span t-esc="partner" /></p>
<table class="table table-bordered table-condensed">
<t t-foreach="" t-as="">
<td><b>ACCOUNT</b></td>
<t t-foreach="" t-as="">
<span><b>PARTER</b></span>
<thead>
<tr>
<th>Date</th>
@ -81,7 +81,7 @@
</tr>
</thead>
<tbody>
<tr t-foreach="" t-as="">
<tr t-foreach="data[account][partner]" t-as="move">
<td></td>
<td></td>
<td></td>
@ -96,38 +96,21 @@
<td></td>
</tr>
<tr>
<td class="col-xs-3 offset col-xs-6">Comulate Balance on Partner</td>
<td></td>
<td></td>
<td></td>
<td>Comulate Balance on Partner</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
</t>
<tr>
<h3>
<td class="col-xs-6">ACCOUNT</td>
<td class="col-xs-3">Comulate Balance</td>
<td></td>
<td></td>
<td></td>
</h3>
</tr>
<p>ACCOUNT Comulate Balance</p>
</t>
</table>
</div>
</t>
</t>
</template>
<template id="open_invoice_report_qweb">
<t t-call="report.html_container">
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang',
'account_financial_report_qweb.open_invoice_report_document')"/>
</t>
</t>
</template>
</data>
</openerp>

62
account_financial_report_qweb/wizard/open_invoice_wizard.py

@ -58,6 +58,66 @@ class OpenInvoiceWizard(models.TransientModel):
raise UserError(
'Until Date must be equal or greater than At Date')
@staticmethod
def _get_domain(data):
account_type = ('payable', 'receivable')
if data['result_selection'] == 'customer':
account_type = ('receivable', )
elif data['result_selection'] == 'supplier':
account_type = ('payable', )
domain = [
('company_id', '=', data['company_id'].id),
('move_id.date', '>=', data['at_date']),
('move_id.date', '<=', data['until_date']),
('account_id.user_type_id.type', 'in', account_type)
]
if data['target_move'] != 'all':
domain.append(('move_id.state', 'in', ('posted', )), )
if data['partner_ids']:
domain.append(('partner_id', 'in', [p.id
for p
in data['partner_ids']]), )
return domain
@staticmethod
def _get_moves_data(move):
# return {
# 'date': data.date,
# 'period': data.invoice_id.period_id.name,
# 'journal': data.move_id.journal_id.name,
# 'reference': data.,
# '': data.,
# '': data.,
# }
return {
'date': '',
'period': '',
'entry': '',
'journal': '',
'reference': '',
'label': '',
'rec': '',
'due_date': '',
'debit': '',
'credit': '',
'balance': '',
}
@api.multi
def print_report(self):
pass
self.ensure_one()
moves = self.env['account.move.line'].search(self._get_domain(self))
if not moves:
return True # ----- Show a message here
datas = {}
for move in moves:
if move.account_id.name not in datas:
datas[move.account_id.name] = {}
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))
return self.env['report'].get_action(
self, 'account_financial_report_qweb.open_invoice_report_qweb',
data={'data': datas})
Loading…
Cancel
Save