andrea4ever
9 years ago
committed by
Leonardo Pistone
4 changed files with 119 additions and 0 deletions
-
1account_financial_report_qweb/__openerp__.py
-
1account_financial_report_qweb/wizard/__init__.py
-
64account_financial_report_qweb/wizard/open_invoice_wizard.py
-
53account_financial_report_qweb/wizard/open_invoice_wizard_view.xml
@ -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 |
@ -0,0 +1,53 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="open_invoice_report_wizard_view" model="ir.ui.view"> |
|||
<field name="name">Open Invoice</field> |
|||
<field name="model">open.invoice.wizard</field> |
|||
<field name="arch" type="xml"> |
|||
<form> |
|||
<group name="main_info"> |
|||
<field name="company_id"/> |
|||
</group> |
|||
<group name="date_info"> |
|||
<field name="at_date"/> |
|||
<field name="until_date" /> |
|||
</group> |
|||
<group name="partner_info"> |
|||
<field name="partner_ids" /> |
|||
</group> |
|||
<group name="layout_info"> |
|||
<field name="amount_currency" /> |
|||
<field name="group_by_currency" /> |
|||
<field name="result_selection" /> |
|||
<field name="target_move" /> |
|||
</group> |
|||
<footer> |
|||
<button name="print_report" |
|||
string="Print Report" |
|||
type="object" class="oe_highlight"/> |
|||
or |
|||
<button string="Cancel" special="cancel" /> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="action_open_invoice_report" model="ir.actions.act_window"> |
|||
<field name="name">Open Invoice</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">open.invoice.wizard</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="view_id" ref="open_invoice_report_wizard_view"/> |
|||
<field name="target">new</field> |
|||
</record> |
|||
|
|||
<menuitem |
|||
parent="account.menu_finance_legal_statement" |
|||
action="action_open_invoice_report" |
|||
id="menu_invoice_report_wizard"/> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue