Browse Source

Review of OCA Open Items Report PDF

pull/367/head
jcoux 8 years ago
committed by Jordi Ballester
parent
commit
ca438bddb6
  1. 5
      account_financial_report_qweb/__openerp__.py
  2. 4
      account_financial_report_qweb/menuitems.xml
  3. 2
      account_financial_report_qweb/report/__init__.py
  4. 34
      account_financial_report_qweb/report/aged_partner_balance.py
  5. 176
      account_financial_report_qweb/report/open_items.py
  6. 76
      account_financial_report_qweb/report/templates/open_items_report.xml
  7. 12
      account_financial_report_qweb/reports.xml
  8. 3
      account_financial_report_qweb/wizard/__init__.py
  9. 15
      account_financial_report_qweb/wizard/open_items_wizard.py
  10. 16
      account_financial_report_qweb/wizard/open_items_wizard_view.xml

5
account_financial_report_qweb/__openerp__.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# Author: Damien Crier
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
@ -22,7 +23,7 @@
'data': [
'wizard/aged_partner_balance_wizard_view.xml',
'wizard/general_ledger_wizard_view.xml',
'wizard/open_invoice_wizard_view.xml',
'wizard/open_items_wizard_view.xml',
'wizard/balance_common_wizard_view.xml',
'wizard/partner_balance_wizard_view.xml',
'wizard/trial_balance_wizard_view.xml',
@ -32,7 +33,7 @@
'report/templates/aged_partner_balance.xml',
'report/templates/general_ledger.xml',
'report/templates/layouts.xml',
'report/templates/open_invoice_report.xml',
'report/templates/open_items_report.xml',
'view/account_view.xml'
],
'test': [

4
account_financial_report_qweb/menuitems.xml

@ -36,8 +36,8 @@
<menuitem
parent="menu_oca_reports"
action='action_open_invoice_wizard'
id='menu_open_invoice_wizard'
action='action_open_items_wizard'
id='menu_open_items_wizard'
/>
</data>

2
account_financial_report_qweb/report/__init__.py

@ -7,4 +7,4 @@
from . import aged_partner_balance
from . import general_ledger
from . import general_ledger_xlsx
from . import open_invoice
from . import open_items

34
account_financial_report_qweb/report/aged_partner_balance.py

@ -19,7 +19,7 @@ class AgedPartnerBalanceReport(models.TransientModel):
filter_partner_ids = fields.Many2many(comodel_name='res.partner')
show_move_line_details = fields.Boolean()
open_invoice_id = fields.Many2one(comodel_name='report_open_invoice_qweb')
open_items_id = fields.Many2one(comodel_name='report_open_items_qweb')
account_ids = fields.One2many(
comodel_name='report_aged_partner_balance_qweb_account',
@ -168,15 +168,15 @@ class AgedPartnerBalanceReportCompute(models.TransientModel):
@api.model
def compute_data_for_report(self):
self.ensure_one()
model = self.env['report_open_invoice_qweb']
self.open_invoice_id = model.create({
model = self.env['report_open_items_qweb']
self.open_items_id = model.create({
'date_at': self.date_at,
'only_posted_moves': self.only_posted_moves,
'company_id': self.company_id.id,
'filter_account_ids': [(6, 0, self.filter_account_ids.ids)],
'filter_partner_ids': [(6, 0, self.filter_partner_ids.ids)],
})
self.open_invoice_id.compute_data_for_report()
self.open_items_id.compute_data_for_report()
self.inject_account_values()
self.inject_partner_values()
@ -207,14 +207,14 @@ SELECT
rao.code,
rao.name
FROM
report_open_invoice_qweb_account rao
report_open_items_qweb_account rao
WHERE
rao.report_id = %s
"""
query_inject_account_params = (
self.id,
self.env.uid,
self.open_invoice_id.id,
self.open_items_id.id,
)
self.env.cr.execute(query_inject_account, query_inject_account_params)
@ -236,9 +236,9 @@ SELECT
rpo.partner_id,
rpo.name
FROM
report_open_invoice_qweb_partner rpo
report_open_items_qweb_partner rpo
INNER JOIN
report_open_invoice_qweb_account rao ON rpo.report_account_id = rao.id
report_open_items_qweb_account rao ON rpo.report_account_id = rao.id
INNER JOIN
report_aged_partner_balance_qweb_account ra ON rao.code = ra.code
WHERE
@ -247,7 +247,7 @@ AND ra.report_id = %s
"""
query_inject_partner_params = (
self.env.uid,
self.open_invoice_id.id,
self.open_items_id.id,
self.id,
)
self.env.cr.execute(query_inject_partner, query_inject_partner_params)
@ -328,11 +328,11 @@ SELECT
) AS older
FROM
date_range,
report_open_invoice_qweb_move_line rlo
report_open_items_qweb_move_line rlo
INNER JOIN
report_open_invoice_qweb_partner rpo ON rlo.report_partner_id = rpo.id
report_open_items_qweb_partner rpo ON rlo.report_partner_id = rpo.id
INNER JOIN
report_open_invoice_qweb_account rao ON rpo.report_account_id = rao.id
report_open_items_qweb_account rao ON rpo.report_account_id = rao.id
INNER JOIN
report_aged_partner_balance_qweb_account ra ON rao.code = ra.code
INNER JOIN
@ -358,7 +358,7 @@ GROUP BY
"""
query_inject_line_params = (self.date_at,) * 6
query_inject_line_params += (
self.open_invoice_id.id,
self.open_items_id.id,
self.id,
)
self.env.cr.execute(query_inject_line, query_inject_line_params)
@ -439,11 +439,11 @@ SELECT
END AS older
FROM
date_range,
report_open_invoice_qweb_move_line rlo
report_open_items_qweb_move_line rlo
INNER JOIN
report_open_invoice_qweb_partner rpo ON rlo.report_partner_id = rpo.id
report_open_items_qweb_partner rpo ON rlo.report_partner_id = rpo.id
INNER JOIN
report_open_invoice_qweb_account rao ON rpo.report_account_id = rao.id
report_open_items_qweb_account rao ON rpo.report_account_id = rao.id
INNER JOIN
report_aged_partner_balance_qweb_account ra ON rao.code = ra.code
INNER JOIN
@ -467,7 +467,7 @@ AND ra.report_id = %s
"""
query_inject_move_line_params = (self.date_at,) * 6
query_inject_move_line_params += (
self.open_invoice_id.id,
self.open_items_id.id,
self.id,
)
self.env.cr.execute(query_inject_move_line,

176
account_financial_report_qweb/report/open_invoice.py → account_financial_report_qweb/report/open_items.py

@ -5,95 +5,120 @@
from openerp import models, fields, api
class OpenInvoiceReport(models.TransientModel):
class OpenItemsReport(models.TransientModel):
""" Here, we just define class fields.
For methods, go more bottom at this file.
The class hierarchy is :
* OpenItemsReport
** OpenItemsReportAccount
*** OpenItemsReportPartner
**** OpenItemsReportMoveLine
"""
_name = 'report_open_invoice_qweb'
_name = 'report_open_items_qweb'
# Filters fields, used for data computation
date_at = fields.Date()
only_posted_moves = fields.Boolean()
hide_account_balance_at_0 = fields.Boolean()
company_id = fields.Many2one(comodel_name='res.company')
filter_account_ids = fields.Many2many(comodel_name='account.account')
filter_partner_ids = fields.Many2many(comodel_name='res.partner')
# Flag fields, used for report display
has_second_currency = fields.Boolean()
# Data fields, used to browse report data
account_ids = fields.One2many(
comodel_name='report_open_invoice_qweb_account',
comodel_name='report_open_items_qweb_account',
inverse_name='report_id'
)
class OpenInvoiceReportAccount(models.TransientModel):
class OpenItemsReportAccount(models.TransientModel):
_name = 'report_open_invoice_qweb_account'
_name = 'report_open_items_qweb_account'
_order = 'code ASC'
report_id = fields.Many2one(
comodel_name='report_open_invoice_qweb',
comodel_name='report_open_items_qweb',
ondelete='cascade',
index=True
)
# Data fields, used to keep link with real object
account_id = fields.Many2one(
'account.account',
index=True
)
# Data fields, used for report display
code = fields.Char()
name = fields.Char()
final_amount_residual = fields.Float(digits=(16, 2))
# Data fields, used to browse report data
partner_ids = fields.One2many(
comodel_name='report_open_invoice_qweb_partner',
comodel_name='report_open_items_qweb_partner',
inverse_name='report_account_id'
)
class OpenInvoiceReportPartner(models.TransientModel):
class OpenItemsReportPartner(models.TransientModel):
_name = 'report_open_invoice_qweb_partner'
_name = 'report_open_items_qweb_partner'
report_account_id = fields.Many2one(
comodel_name='report_open_invoice_qweb_account',
comodel_name='report_open_items_qweb_account',
ondelete='cascade',
index=True
)
# Data fields, used to keep link with real object
partner_id = fields.Many2one(
'res.partner',
index=True
)
# Data fields, used for report display
name = fields.Char()
final_amount_residual = fields.Float(digits=(16, 2))
# Data fields, used to browse report data
move_line_ids = fields.One2many(
comodel_name='report_open_invoice_qweb_move_line',
comodel_name='report_open_items_qweb_move_line',
inverse_name='report_partner_id'
)
@api.model
def _generate_order_by(self, order_spec, query):
"""Custom order to display "No partner allocated" at last position."""
return """
ORDER BY
CASE
WHEN "report_open_invoice_qweb_partner"."partner_id" IS NOT NULL
CASE
WHEN "report_open_items_qweb_partner"."partner_id" IS NOT NULL
THEN 0
ELSE 1
END,
"report_open_invoice_qweb_partner"."name"
"report_open_items_qweb_partner"."name"
"""
class OpenInvoiceReportMoveLine(models.TransientModel):
class OpenItemsReportMoveLine(models.TransientModel):
_name = 'report_open_invoice_qweb_move_line'
_name = 'report_open_items_qweb_move_line'
report_partner_id = fields.Many2one(
comodel_name='report_open_invoice_qweb_partner',
comodel_name='report_open_items_qweb_partner',
ondelete='cascade',
index=True
)
# Data fields, used to keep link with real object
move_line_id = fields.Many2one('account.move.line')
# Data fields, used for report display
date = fields.Date()
date_due = fields.Date()
entry = fields.Char()
@ -108,38 +133,43 @@ class OpenInvoiceReportMoveLine(models.TransientModel):
amount_residual_currency = fields.Float(digits=(16, 2))
class OpenInvoiceReportCompute(models.TransientModel):
class OpenItemsReportCompute(models.TransientModel):
""" Here, we just define methods.
For class fields, go more top at this file.
"""
_inherit = 'report_open_invoice_qweb'
_inherit = 'report_open_items_qweb'
@api.model
@api.multi
def print_report(self):
self.ensure_one()
self.compute_data_for_report()
report_name = 'account_financial_report_qweb.report_open_items_qweb'
return {
'type': 'ir.actions.report.xml',
'report_name':
'account_financial_report_qweb.report_open_invoice_qweb',
'report_name': report_name,
'datas': {'ids': [self.id]},
}
@api.model
@api.multi
def compute_data_for_report(self):
self.ensure_one()
self.inject_account_values()
self.inject_partner_values()
self.inject_line_values()
self.inject_line_values(only_empty_partner_line=True)
self.clean_partners_and_accounts()
self.compute_partners_and_accounts_cumul()
# Compute report data
self._inject_account_values()
self._inject_partner_values()
self._inject_line_values()
self._inject_line_values(only_empty_partner_line=True)
self._clean_partners_and_accounts()
self._compute_partners_and_accounts_cumul()
if self.hide_account_balance_at_0:
self.clean_partners_and_accounts(
self._clean_partners_and_accounts(
only_delete_account_balance_at_0=True
)
self.compute_has_second_currency()
# Compute display flag
self._compute_has_second_currency()
def inject_account_values(self):
def _inject_account_values(self):
"""Inject report values for report_open_items_qweb_account."""
query_inject_account = """
WITH
accounts AS
@ -184,7 +214,7 @@ WITH
a.id
)
INSERT INTO
report_open_invoice_qweb_account
report_open_items_qweb_account
(
report_id,
create_uid,
@ -221,7 +251,8 @@ FROM
)
self.env.cr.execute(query_inject_account, query_inject_account_params)
def inject_partner_values(self):
def _inject_partner_values(self):
""" Inject report values for report_open_items_qweb_partner. """
query_inject_partner = """
WITH
accounts_partners AS
@ -242,7 +273,7 @@ WITH
'No partner allocated'
) AS partner_name
FROM
report_open_invoice_qweb_account ra
report_open_items_qweb_account ra
INNER JOIN
account_account a ON ra.account_id = a.id
INNER JOIN
@ -274,7 +305,7 @@ WITH
at.include_initial_balance
)
INSERT INTO
report_open_invoice_qweb_partner
report_open_items_qweb_partner
(
report_account_id,
create_uid,
@ -304,7 +335,12 @@ FROM
)
self.env.cr.execute(query_inject_partner, query_inject_partner_params)
def inject_line_values(self, only_empty_partner_line=False):
def _inject_line_values(self, only_empty_partner_line=False):
""" Inject report values for report_open_items_qweb_move_line.
The "only_empty_partner_line" value is used
to compute data without partner.
"""
query_inject_move_line = """
WITH
move_lines_amount AS
@ -328,9 +364,9 @@ WITH
END
) AS partial_amount_currency
FROM
report_open_invoice_qweb_partner rp
report_open_items_qweb_partner rp
INNER JOIN
report_open_invoice_qweb_account ra
report_open_items_qweb_account ra
ON rp.report_account_id = ra.id
INNER JOIN
account_move_line ml
@ -408,7 +444,7 @@ WITH
amount_currency
)
INSERT INTO
report_open_invoice_qweb_move_line
report_open_items_qweb_move_line
(
report_partner_id,
create_uid,
@ -460,9 +496,9 @@ SELECT
ml.amount_currency,
ml2.amount_residual_currency
FROM
report_open_invoice_qweb_partner rp
report_open_items_qweb_partner rp
INNER JOIN
report_open_invoice_qweb_account ra ON rp.report_account_id = ra.id
report_open_items_qweb_account ra ON rp.report_account_id = ra.id
INNER JOIN
account_move_line ml ON ra.account_id = ml.account_id
INNER JOIN
@ -525,19 +561,22 @@ ORDER BY
self.date_at,)
)
def compute_partners_and_accounts_cumul(self):
def _compute_partners_and_accounts_cumul(self):
""" Compute cumulative amount for
report_open_items_qweb_partner and report_open_items_qweb_account.
"""
query_compute_partners_cumul = """
UPDATE
report_open_invoice_qweb_partner
report_open_items_qweb_partner
SET
final_amount_residual =
(
SELECT
SUM(rml.amount_residual) AS final_amount_residual
FROM
report_open_invoice_qweb_move_line rml
report_open_items_qweb_move_line rml
WHERE
rml.report_partner_id = report_open_invoice_qweb_partner.id
rml.report_partner_id = report_open_items_qweb_partner.id
)
WHERE
id IN
@ -545,9 +584,9 @@ WHERE
SELECT
rp.id
FROM
report_open_invoice_qweb_account ra
report_open_items_qweb_account ra
INNER JOIN
report_open_invoice_qweb_partner rp
report_open_items_qweb_partner rp
ON ra.id = rp.report_account_id
WHERE
ra.report_id = %s
@ -558,16 +597,16 @@ WHERE
params_compute_partners_cumul)
query_compute_accounts_cumul = """
UPDATE
report_open_invoice_qweb_account
report_open_items_qweb_account
SET
final_amount_residual =
(
SELECT
SUM(rp.final_amount_residual) AS final_amount_residual
FROM
report_open_invoice_qweb_partner rp
report_open_items_qweb_partner rp
WHERE
rp.report_account_id = report_open_invoice_qweb_account.id
rp.report_account_id = report_open_items_qweb_account.id
)
WHERE
report_id = %s
@ -576,23 +615,29 @@ WHERE
self.env.cr.execute(query_compute_accounts_cumul,
params_compute_accounts_cumul)
def clean_partners_and_accounts(self,
def _clean_partners_and_accounts(self,
only_delete_account_balance_at_0=False):
""" Delete empty data for
report_open_items_qweb_partner and report_open_items_qweb_account.
The "only_delete_account_balance_at_0" value is used
to delete also the data with cumulative amounts at 0.
"""
query_clean_partners = """
DELETE FROM
report_open_invoice_qweb_partner
report_open_items_qweb_partner
WHERE
id IN
(
SELECT
DISTINCT rp.id
FROM
report_open_invoice_qweb_account ra
report_open_items_qweb_account ra
INNER JOIN
report_open_invoice_qweb_partner rp
report_open_items_qweb_partner rp
ON ra.id = rp.report_account_id
LEFT JOIN
report_open_invoice_qweb_move_line rml
report_open_items_qweb_move_line rml
ON rp.id = rml.report_partner_id
WHERE
ra.report_id = %s
@ -615,16 +660,16 @@ WHERE
self.env.cr.execute(query_clean_partners, params_clean_partners)
query_clean_accounts = """
DELETE FROM
report_open_invoice_qweb_account
report_open_items_qweb_account
WHERE
id IN
(
SELECT
DISTINCT ra.id
FROM
report_open_invoice_qweb_account ra
report_open_items_qweb_account ra
LEFT JOIN
report_open_invoice_qweb_partner rp
report_open_items_qweb_partner rp
ON ra.id = rp.report_account_id
WHERE
ra.report_id = %s
@ -646,22 +691,23 @@ WHERE
params_clean_accounts = (self.id,)
self.env.cr.execute(query_clean_accounts, params_clean_accounts)
def compute_has_second_currency(self):
def _compute_has_second_currency(self):
""" Compute "has_second_currency" flag which will used for display."""
query_update_has_second_currency = """
UPDATE
report_open_invoice_qweb
report_open_items_qweb
SET
has_second_currency =
(
SELECT
TRUE
FROM
report_open_invoice_qweb_move_line l
report_open_items_qweb_move_line l
INNER JOIN
report_open_invoice_qweb_partner p
report_open_items_qweb_partner p
ON l.report_partner_id = p.id
INNER JOIN
report_open_invoice_qweb_account a
report_open_items_qweb_account a
ON p.report_account_id = a.id
WHERE
a.report_id = %s

76
account_financial_report_qweb/report/templates/open_invoice_report.xml → account_financial_report_qweb/report/templates/open_items_report.xml

@ -1,54 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="account_financial_report_qweb.report_open_invoice_qweb">
<template id="account_financial_report_qweb.report_open_items_qweb">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<!-- Saved flag fields into variables, used to define columns display -->
<t t-set="has_second_currency" t-value="o.has_second_currency"/>
<t t-call="account_financial_report_qweb.internal_layout">
<!-- Defines global variables used by internal layout -->
<t t-set="title" t-value='"Open Items Report"'/>
<t t-set="company_name" t-value="o.company_id.name"/>
<div class="page">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_row labels">
<div class="act_as_cell">Date at filter</div>
<div class="act_as_cell">Target moves filter</div>
<div class="act_as_cell">Account balance at 0 filter</div>
</div>
<div class="act_as_row">
<div class="act_as_cell">
<span t-field="o.date_at"/>
</div>
<div class="act_as_cell">
<t t-if="o.only_posted_moves">All posted entries</t>
<t t-if="not o.only_posted_moves">All entries</t>
</div>
<div class="act_as_cell">
<t t-if="o.hide_account_balance_at_0">Hide</t>
<t t-if="not o.hide_account_balance_at_0">Show</t>
</div>
</div>
</div>
<!-- Display filters -->
<t t-call="account_financial_report_qweb.report_open_items_qweb_filters"/>
<t t-foreach="o.account_ids" t-as="account">
<div class="page_break">
<!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<span t-field="account.code"/> - <span t-field="account.name"/>
</div>
<!-- Display account partners -->
<t t-foreach="account.partner_ids" t-as="partner">
<div class="page_break">
<!-- Display partner header -->
<div class="act_as_caption account_title">
<span t-field="partner.name"/>
</div>
<t t-call="account_financial_report_qweb.report_open_invoice_qweb_lines"/>
<t t-call="account_financial_report_qweb.report_open_invoice_qweb_ending_cumul">
<!-- Display partner move lines -->
<t t-call="account_financial_report_qweb.report_open_items_qweb_lines"/>
<!-- Display partner footer -->
<t t-call="account_financial_report_qweb.report_open_items_qweb_ending_cumul">
<t t-set="account_or_partner_object" t-value="partner"/>
<t t-set="type" t-value='"partner_type"'/>
</t>
</div>
</t>
<t t-call="account_financial_report_qweb.report_open_invoice_qweb_ending_cumul">
<!-- Display account footer -->
<t t-call="account_financial_report_qweb.report_open_items_qweb_ending_cumul">
<t t-set="account_or_partner_object" t-value="account"/>
<t t-set="type" t-value='"account_type"'/>
</t>
@ -60,8 +56,33 @@
</t>
</template>
<template id="account_financial_report_qweb.report_open_invoice_qweb_lines">
<template id="account_financial_report_qweb.report_open_items_qweb_filters">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_row labels">
<div class="act_as_cell">Date at filter</div>
<div class="act_as_cell">Target moves filter</div>
<div class="act_as_cell">Account balance at 0 filter</div>
</div>
<div class="act_as_row">
<div class="act_as_cell">
<span t-field="o.date_at"/>
</div>
<div class="act_as_cell">
<t t-if="o.only_posted_moves">All posted entries</t>
<t t-if="not o.only_posted_moves">All entries</t>
</div>
<div class="act_as_cell">
<t t-if="o.hide_account_balance_at_0">Hide</t>
<t t-if="not o.hide_account_balance_at_0">Show</t>
</div>
</div>
</div>
</template>
<template id="account_financial_report_qweb.report_open_items_qweb_lines">
<div class="act_as_table data_table" style="width: 1140px !important;">
<!-- Display table headers for lines -->
<div class="act_as_thead">
<div class="act_as_row labels">
<!--## date-->
@ -92,6 +113,8 @@
</t>
</div>
</div>
<!-- Display each lines -->
<t t-foreach="partner.move_line_ids" t-as="line">
<!-- # lines or centralized lines -->
<div class="act_as_row lines">
@ -134,7 +157,8 @@
</div>
</template>
<template id="account_financial_report_qweb.report_open_invoice_qweb_ending_cumul">
<template id="account_financial_report_qweb.report_open_items_qweb_ending_cumul">
<!-- Display ending balance line for account or partner -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_row labels" style="font-weight: bold;">
<!--## date-->

12
account_financial_report_qweb/reports.xml

@ -21,12 +21,12 @@
/>
<report
id="action_report_open_invoice_qweb"
model="report_open_invoice_qweb"
string="Open Invoice"
id="action_report_open_items_qweb"
model="report_open_items_qweb"
string="Open Items"
report_type="qweb-pdf"
name="account_financial_report_qweb.report_open_invoice_qweb"
file="account_financial_report_qweb.report_open_invoice_qweb"
name="account_financial_report_qweb.report_open_items_qweb"
file="account_financial_report_qweb.report_open_items_qweb"
/>
<report
@ -67,7 +67,7 @@
<field name="paperformat_id" ref="report_qweb_paperformat"/>
</record>
<record id="action_report_open_invoice_qweb" model="ir.actions.report.xml">
<record id="action_report_open_items_qweb" model="ir.actions.report.xml">
<field name="paperformat_id" ref="report_qweb_paperformat"/>
</record>

3
account_financial_report_qweb/wizard/__init__.py

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
# Author: Damien Crier
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import aged_partner_balance_wizard
from . import balance_common_wizard
from . import general_ledger_wizard
from . import open_invoice_wizard
from . import open_items_wizard

15
account_financial_report_qweb/wizard/open_invoice_wizard.py → account_financial_report_qweb/wizard/open_items_wizard.py

@ -8,11 +8,11 @@ from datetime import datetime
from openerp import models, fields, api
class OpenInvoiceReportWizard(models.TransientModel):
"""Open invoice report wizard."""
class OpenItemsReportWizard(models.TransientModel):
"""Open items report wizard."""
_name = "open.invoice.report.wizard"
_description = "Open Invoice Report Wizard"
_name = "open.items.report.wizard"
_description = "Open Items Report Wizard"
company_id = fields.Many2one(
comodel_name='res.company',
@ -69,7 +69,12 @@ class OpenInvoiceReportWizard(models.TransientModel):
@api.multi
def button_export_pdf(self):
model = self.env['report_open_invoice_qweb']
self.ensure_one()
return self._export()
def _export(self):
"""Default export is PDF."""
model = self.env['report_open_items_qweb']
report = model.create({
'date_at': self.date_at,
'only_posted_moves': self.target_move == 'posted',

16
account_financial_report_qweb/wizard/open_invoice_wizard_view.xml → account_financial_report_qweb/wizard/open_items_wizard_view.xml

@ -2,10 +2,10 @@
<openerp>
<data>
<!-- OPEN INVOICE -->
<record id="open_invoice_wizard" model="ir.ui.view">
<field name="name">Open Invoice</field>
<field name="model">open.invoice.report.wizard</field>
<!-- OPEN ITEMS -->
<record id="open_items_wizard" model="ir.ui.view">
<field name="name">Open Items</field>
<field name="model">open.items.report.wizard</field>
<field name="arch" type="xml">
<form>
<group name="main_info">
@ -38,13 +38,13 @@
</field>
</record>
<record id="action_open_invoice_wizard" model="ir.actions.act_window">
<field name="name">Open Invoice</field>
<record id="action_open_items_wizard" model="ir.actions.act_window">
<field name="name">Open Items</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">open.invoice.report.wizard</field>
<field name="res_model">open.items.report.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="open_invoice_wizard"/>
<field name="view_id" ref="open_items_wizard"/>
<field name="target">new</field>
</record>
Loading…
Cancel
Save