From d46fb1944b0dfa9b359e2922af72f0e4b81b8b64 Mon Sep 17 00:00:00 2001 From: andrea4ever <4everamd@gmail.com> Date: Wed, 27 Apr 2016 11:03:27 +0200 Subject: [PATCH] First commit for open invoice report --- account_financial_report_qweb/__openerp__.py | 1 + .../wizard/__init__.py | 1 + .../wizard/open_invoice_wizard.py | 64 +++++++++++++++++++ .../wizard/open_invoice_wizard_view.xml | 53 +++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 account_financial_report_qweb/wizard/open_invoice_wizard.py create mode 100644 account_financial_report_qweb/wizard/open_invoice_wizard_view.xml diff --git a/account_financial_report_qweb/__openerp__.py b/account_financial_report_qweb/__openerp__.py index 0c94ae59..8d60cdf2 100644 --- a/account_financial_report_qweb/__openerp__.py +++ b/account_financial_report_qweb/__openerp__.py @@ -20,6 +20,7 @@ 'data': [ 'wizard/aged_partner_balance_wizard_view.xml', 'wizard/ledger_report_wizard_view.xml', + 'wizard/open_invoice_wizard_view.xml', 'report_menus.xml', 'wizard/balance_common_wizard_view.xml', 'views/report_menus.xml', diff --git a/account_financial_report_qweb/wizard/__init__.py b/account_financial_report_qweb/wizard/__init__.py index 409aa005..8ff39244 100644 --- a/account_financial_report_qweb/wizard/__init__.py +++ b/account_financial_report_qweb/wizard/__init__.py @@ -5,3 +5,4 @@ from . import aged_partner_balance_wizard from . import ledger_report_wizard from . import balance_common_wizard +from . import open_invoice_wizard diff --git a/account_financial_report_qweb/wizard/open_invoice_wizard.py b/account_financial_report_qweb/wizard/open_invoice_wizard.py new file mode 100644 index 00000000..73f05524 --- /dev/null +++ b/account_financial_report_qweb/wizard/open_invoice_wizard.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Author: Andrea andrea4ever Gallina +# Author: Francesco OpenCode Apruzzese +# Author: Ciro CiroBoxHub Urselli +# Copyright 2016 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models, fields, api, _ +from openerp.exceptions import Warning as UserError +from datetime import datetime + + +class OpenInvoiceWizard(models.TransientModel): + + _name = 'open.invoice.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())) + partner_ids = fields.Many2many( + 'res.partner', comodel_name='res.partner', + string='Filter partners',) + amount_currency = fields.Boolean( + "With Currency", help="It adds the currency column") + group_by_currency = fields.Boolean( + "Group Partner by currency", help="It adds the currency column") + 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') + until_date = fields.Date( + "Clearance date", required=True, + help="""The clearance date is essentially a tool used for debtors + provisionning calculation. + By default, this date is equal to the the end date ( + ie: 31/12/2011 if you select fy 2011). + By amending the clearance date, you will be, for instance, + able to answer the question : 'based on my last + year end debtors open invoices, which invoices are still + unpaid today (today is my clearance date)?'""") + + @api.onchange('at_date') + def onchange_atdate(self): + self.until_date = self.at_date + + @api.onchange('until_date') + def onchange_untildate(self): + # ---- until_date must be always >= of at_date + if self.until_date: + if self.until_date < self.at_date: + raise UserError( + 'Until Date must be equal or greater then At Date') + + @api.multi + def print_report(self): + pass diff --git a/account_financial_report_qweb/wizard/open_invoice_wizard_view.xml b/account_financial_report_qweb/wizard/open_invoice_wizard_view.xml new file mode 100644 index 00000000..8a3870f1 --- /dev/null +++ b/account_financial_report_qweb/wizard/open_invoice_wizard_view.xml @@ -0,0 +1,53 @@ + + + + + + Open Invoice + open.invoice.wizard + +
+ + + + + + + + + + + + + + + + +
+
+
+
+
+ + + Open Invoice + ir.actions.act_window + open.invoice.wizard + form + form + + new + + + + +
+
\ No newline at end of file