Browse Source

[IMP] Fill report open invoice with first info's

pull/367/head
andrea4ever 9 years ago
committed by Jordi Ballester
parent
commit
810b9c50af
  1. 5
      account_financial_report_qweb/reports.xml
  2. 36
      account_financial_report_qweb/wizard/open_invoice_wizard.py
  3. 1
      account_financial_report_qweb/wizard/open_invoice_wizard_view.xml

5
account_financial_report_qweb/reports.xml

@ -25,12 +25,13 @@
<report <report
string="Open Invoice Report" string="Open Invoice Report"
id="action_open_invoice_report"
id="report_open_invoice_report"
model="open.invoice.wizard" model="open.invoice.wizard"
report_type="qweb-pdf" report_type="qweb-pdf"
name="account_financial_report_qweb.open_invoice_report_qweb" name="account_financial_report_qweb.open_invoice_report_qweb"
file="account_financial_report_qweb.open_invoice_report_qweb"/> file="account_financial_report_qweb.open_invoice_report_qweb"/>
<record id="action_open_invoice_report" model="ir.actions.report.xml">
<record id="report_open_invoice_report" model="ir.actions.report.xml">
<field name="paperformat_id" ref="account_financial_report_qweb.open_invoice_report_format_a4_horizontal"/> <field name="paperformat_id" ref="account_financial_report_qweb.open_invoice_report_format_a4_horizontal"/>
</record> </record>

36
account_financial_report_qweb/wizard/open_invoice_wizard.py

@ -5,7 +5,7 @@
# Copyright 2016 Camptocamp SA # Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api
from openerp import models, fields, api, _
from openerp.exceptions import Warning as UserError from openerp.exceptions import Warning as UserError
from datetime import datetime from datetime import datetime
@ -36,7 +36,7 @@ class OpenInvoiceWizard(models.TransientModel):
('all', 'All Entries')], 'Target Moves', ('all', 'All Entries')], 'Target Moves',
required=True, default='all') required=True, default='all')
until_date = fields.Date( until_date = fields.Date(
"Clearance date", required=True,
"Clearance date",
help="""The clearance date is essentially a tool used for debtors help="""The clearance date is essentially a tool used for debtors
provisionning calculation. provisionning calculation.
By default, this date is equal to the the end date ( By default, this date is equal to the the end date (
@ -67,8 +67,7 @@ class OpenInvoiceWizard(models.TransientModel):
account_type = ('payable', ) account_type = ('payable', )
domain = [ domain = [
('company_id', '=', data['company_id'].id), ('company_id', '=', data['company_id'].id),
('move_id.date', '>=', data['at_date']),
('move_id.date', '<=', data['until_date']),
('move_id.date', '<=', data['at_date']),
('account_id.user_type_id.type', 'in', account_type) ('account_id.user_type_id.type', 'in', account_type)
] ]
if data['target_move'] != 'all': if data['target_move'] != 'all':
@ -81,25 +80,18 @@ class OpenInvoiceWizard(models.TransientModel):
@staticmethod @staticmethod
def _get_moves_data(move): 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 { return {
'date': '',
'date': move.date,
'period': '', 'period': '',
'entry': '',
'journal': '',
'reference': '',
'label': '',
'rec': '',
'due_date': '',
'debit': '',
'credit': '',
'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),
'rec': move.full_reconcile_id.name,
'due_date': move.date_maturity,
'debit': move.debit or '',
'credit': move.credit or '',
'balance': '', 'balance': '',
} }
@ -117,6 +109,6 @@ class OpenInvoiceWizard(models.TransientModel):
datas[move.account_id.name][move.partner_id.name] = [] datas[move.account_id.name][move.partner_id.name] = []
datas[move.account_id.name][move.partner_id.name].append( datas[move.account_id.name][move.partner_id.name].append(
self._get_moves_data(move)) self._get_moves_data(move))
return self.env['report'].get_action(
return self.env['report'].with_context(landscape=True).get_action(
self, 'account_financial_report_qweb.open_invoice_report_qweb', self, 'account_financial_report_qweb.open_invoice_report_qweb',
data={'data': datas}) data={'data': datas})

1
account_financial_report_qweb/wizard/open_invoice_wizard_view.xml

@ -12,7 +12,6 @@
</group> </group>
<group name="date_info"> <group name="date_info">
<field name="at_date"/> <field name="at_date"/>
<field name="until_date" />
</group> </group>
<group name="partner_info"> <group name="partner_info">
<field name="partner_ids" /> <field name="partner_ids" />

Loading…
Cancel
Save