-
-
-
-
-
-
-
-
-
-
-
-
Total
-
+
+
-
-
-
-
-
-
-
-
-
-
Total
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
Total
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
Date
+
+
Entry
+
+
Journal
+
+
Account
+
+
Partner
+
+
Ref - Label
+
+
Due date
+
+
Original
+
+
Residual
+
+
+ Cur.
+
+ Cur. Original
+
+ Cur. Residual
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+ -
+ Ending balance
+
+
+
+ Partner ending balance
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
\ No newline at end of file
+
diff --git a/account_financial_report_qweb/reports.xml b/account_financial_report_qweb/reports.xml
index d1fe0f0c..a06012a4 100644
--- a/account_financial_report_qweb/reports.xml
+++ b/account_financial_report_qweb/reports.xml
@@ -11,30 +11,14 @@
file="account_financial_report_qweb.report_general_ledger_qweb"
/>
-
-
-
- Open Invoice Report Internal A4 Horizontal
- 30
- 20
- 20
- Landscape
-
-
-
-
-
-
-
-
-
+ id="action_report_open_invoice_qweb"
+ model="report_open_invoice_qweb"
+ string="Open Invoice"
+ report_type="qweb-pdf"
+ name="account_financial_report_qweb.report_open_invoice_qweb"
+ file="account_financial_report_qweb.report_open_invoice_qweb"
+ />
General Ledger XLSX report
@@ -65,5 +49,9 @@
+
+
+
+
diff --git a/account_financial_report_qweb/wizard/open_invoice_wizard.py b/account_financial_report_qweb/wizard/open_invoice_wizard.py
index b3fee002..90b374f9 100644
--- a/account_financial_report_qweb/wizard/open_invoice_wizard.py
+++ b/account_financial_report_qweb/wizard/open_invoice_wizard.py
@@ -1,72 +1,81 @@
# -*- coding: utf-8 -*-
-# Author: Andrea andrea4ever Gallina
-# Author: Francesco OpenCode Apruzzese
-# Author: Ciro CiroBoxHub Urselli
+# Author: Damien Crier
+# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-from openerp import models, fields, api
from datetime import datetime
+from openerp import models, fields, api
-class OpenInvoiceWizard(models.TransientModel):
+class OpenInvoiceReportWizard(models.TransientModel):
+ """Open invoice report wizard."""
- _name = 'open.invoice.wizard'
+ _name = "open.invoice.report.wizard"
+ _description = "Open Invoice Report Wizard"
company_id = fields.Many2one(
- 'res.company', required=True,
- default=lambda s: s.env.user.company_id)
- at_date = fields.Date(
- required=True,
- default=fields.Date.to_string(datetime.today()))
+ comodel_name='res.company',
+ default=lambda self: self.env.user.company_id
+ )
+ date_at = fields.Date(required=True,
+ default=fields.Date.to_string(datetime.today()))
+ target_move = fields.Selection([('posted', 'All Posted Entries'),
+ ('all', 'All Entries')],
+ string='Target Moves',
+ required=True,
+ default='all')
+ account_ids = fields.Many2many(
+ comodel_name='account.account',
+ string='Filter accounts',
+ )
+ hide_account_balance_at_0 = fields.Boolean(
+ string='Hide account ending balance at 0',
+ help='Use this filter to hide an account or a partner '
+ 'with an ending balance at 0. '
+ 'If partners are filtered, '
+ 'debits and credits totals will not match the trial balance.',
+ default=False)
+ receivable_accounts_only = fields.Boolean()
+ payable_accounts_only = fields.Boolean()
partner_ids = fields.Many2many(
- 'res.partner', string='Filter partners')
- result_selection = fields.Selection([
- ('customer', 'Receivable Accounts'),
- ('supplier', 'Payable Accounts'),
- ('customer_supplier', 'Receivable and Payable Accounts')],
- "Partner's", required=True, default='customer')
- target_move = fields.Selection([
- ('posted', 'All Posted Entries'),
- ('all', 'All Entries')], 'Target Moves',
- required=True, default='all')
-
- @api.onchange('at_date')
- def onchange_atdate(self):
- self.until_date = self.at_date
-
- def _build_contexts(self, data):
- result = {}
- return result
+ comodel_name='res.partner',
+ string='Filter partners',
+ )
- def _build_header(self):
- return {
- '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],
- }
+ @api.onchange('date_range_id')
+ def onchange_date_range_id(self):
+ """Handle date range change."""
+ self.date_at = self.date_range_id.date_end
+ if self.date_range_id.date_start:
+ self.fy_start_date = self.env.user.company_id.find_daterange_fy(
+ fields.Date.from_string(self.date_range_id.date_start)
+ ).date_start
- def _get_form_fields(self):
- return self.read(['company_id', 'at_date', 'partner_ids',
- 'result_selection', 'target_move',
- 'until_date'])[0]
+ @api.onchange('receivable_accounts_only', 'payable_accounts_only')
+ def onchange_type_accounts_only(self):
+ """Handle receivable/payable accounts only change."""
+ if self.receivable_accounts_only or self.payable_accounts_only:
+ domain = []
+ if self.receivable_accounts_only and self.payable_accounts_only:
+ domain += [('internal_type', 'in', ('receivable', 'payable'))]
+ elif self.receivable_accounts_only:
+ domain += [('internal_type', '=', 'receivable')]
+ elif self.payable_accounts_only:
+ domain += [('internal_type', '=', 'payable')]
+ self.account_ids = self.env['account.account'].search(domain)
+ else:
+ self.account_ids = None
@api.multi
- def print_report(self):
- self.ensure_one()
- data = {}
- data['ids'] = self.env.context.get('active_ids', [])
- data['model'] = self.env.context.get('active_model', 'ir.ui.menu')
- data['form'] = self._get_form_fields()
- used_context = self._build_contexts(data)
- data['form']['used_context'] = dict(
- used_context, lang=self.env.context.get('lang', 'en_US'))
- data['header'] = self._build_header()
- return self.env['report'].get_action(
- self, 'account_financial_report_qweb.open_invoice_report_qweb',
- data=data)
+ def button_export_pdf(self):
+ model = self.env['report_open_invoice_qweb']
+ report = model.create({
+ 'date_at': self.date_at,
+ 'only_posted_moves': self.target_move == 'posted',
+ 'hide_account_balance_at_0': self.hide_account_balance_at_0,
+ 'company_id': self.company_id.id,
+ 'filter_account_ids': [(6, 0, self.account_ids.ids)],
+ 'filter_partner_ids': [(6, 0, self.partner_ids.ids)],
+ })
+ return report.print_report()
diff --git a/account_financial_report_qweb/wizard/open_invoice_wizard_view.xml b/account_financial_report_qweb/wizard/open_invoice_wizard_view.xml
index 84c7eb02..60487b3f 100644
--- a/account_financial_report_qweb/wizard/open_invoice_wizard_view.xml
+++ b/account_financial_report_qweb/wizard/open_invoice_wizard_view.xml
@@ -1,45 +1,52 @@
-
+
-
+
+
Open Invoice
- open.invoice.wizard
+ open.invoice.report.wizard
-
+
Open Invoice
ir.actions.act_window
- open.invoice.wizard
+ open.invoice.report.wizard
form
form
-
+
new
-
+
\ No newline at end of file