[IMP] Fill report open invoice with first info's
parent
297029fce2
commit
55d30d5440
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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['at_date']),
|
||||||
('move_id.date', '<=', data['until_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': '',
|
'entry': move.move_id.name,
|
||||||
'journal': '',
|
'journal': move.move_id.journal_id.code,
|
||||||
'reference': '',
|
'reference': move.ref,
|
||||||
'label': '',
|
'label': '{move_line_name} ({move_ref})'.format(
|
||||||
'rec': '',
|
move_line_name=move.name, move_ref=move.move_id.ref),
|
||||||
'due_date': '',
|
'rec': move.full_reconcile_id.name,
|
||||||
'debit': '',
|
'due_date': move.date_maturity,
|
||||||
'credit': '',
|
'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})
|
||||||
|
|
|
@ -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…
Reference in New Issue