From 7d0ea7967c32129ce38f9c6601b81ad70b9a87df Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 27 Jan 2016 18:33:27 +0100 Subject: [PATCH] Add module account_move_line_filter_wizard --- account_move_line_filter_wizard/__init__.py | 3 + .../__openerp__.py | 43 +++++++++++++ .../wizard/__init__.py | 3 + .../wizard/account_move_line_filter.py | 62 +++++++++++++++++++ .../wizard/account_move_line_filter_view.xml | 46 ++++++++++++++ 5 files changed, 157 insertions(+) create mode 100644 account_move_line_filter_wizard/__init__.py create mode 100644 account_move_line_filter_wizard/__openerp__.py create mode 100644 account_move_line_filter_wizard/wizard/__init__.py create mode 100644 account_move_line_filter_wizard/wizard/account_move_line_filter.py create mode 100644 account_move_line_filter_wizard/wizard/account_move_line_filter_view.xml diff --git a/account_move_line_filter_wizard/__init__.py b/account_move_line_filter_wizard/__init__.py new file mode 100644 index 0000000..3b4c3ed --- /dev/null +++ b/account_move_line_filter_wizard/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import wizard diff --git a/account_move_line_filter_wizard/__openerp__.py b/account_move_line_filter_wizard/__openerp__.py new file mode 100644 index 0000000..1d71cc1 --- /dev/null +++ b/account_move_line_filter_wizard/__openerp__.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Account Move Line Filter Wizard module for Odoo +# Copyright (C) 2016 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'Account Move Line Filter Wizard', + 'version': '0.1', + 'category': 'Accounting & Finance', + 'license': 'AGPL-3', + 'summary': 'Easy and fast access to the details of an account', + 'description': """ +Account Move Line Filter Wizard +=============================== + +This module adds a wizard in Accounting > ... > + +This module has been written by Alexis de Lattre from Akretion . + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['account_usability'], + 'data': ['wizard/account_move_line_filter_view.xml'], + 'installable': True, +} diff --git a/account_move_line_filter_wizard/wizard/__init__.py b/account_move_line_filter_wizard/wizard/__init__.py new file mode 100644 index 0000000..9718359 --- /dev/null +++ b/account_move_line_filter_wizard/wizard/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import account_move_line_filter diff --git a/account_move_line_filter_wizard/wizard/account_move_line_filter.py b/account_move_line_filter_wizard/wizard/account_move_line_filter.py new file mode 100644 index 0000000..869c952 --- /dev/null +++ b/account_move_line_filter_wizard/wizard/account_move_line_filter.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Account Move Line Filter Wizard module for Odoo +# Copyright (C) 2016 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api + + +class AccountMoveLineFilterWizard(models.TransientModel): + _name = 'account.move.line.filter.wizard' + _description = 'Wizard for easy and fast access to account move lines' + + partner_id = fields.Many2one( + 'res.partner', string='Partner', domain=[('parent_id', '=', False)]) + account_id = fields.Many2one( + 'account.account', string='Account', + domain=[('type', 'not in', ('view', 'closed'))], required=True) + account_reconcile = fields.Boolean(related='account_id.reconcile') + reconcile = fields.Selection([ + ('unreconciled', 'Unreconciled'), + ('reconciled', 'Fully Reconciled'), + ('partial_reconciled', 'Partially Reconciled'), + ], string='Reconciliation Filter') + + @api.onchange('partner_id') + def partner_id_change(self): + if self.partner_id: + if self.partner_id.customer: + self.account_id =\ + self.partner_id.property_account_receivable.id + else: + self.account_id = self.partner_id.property_account_payable.id + + @api.multi + def go(self): + self.ensure_one() + action = self.env['ir.actions.act_window'].for_xml_id( + 'account', 'action_account_moves_all_a') + action['context'] = {'search_default_account_id': [self.account_id.id]} + if self.partner_id: + action['context']['search_default_partner_id'] =\ + [self.partner_id.id] + if self.reconcile: + action['context']['search_default_%s' % self.reconcile] = True + return action diff --git a/account_move_line_filter_wizard/wizard/account_move_line_filter_view.xml b/account_move_line_filter_wizard/wizard/account_move_line_filter_view.xml new file mode 100644 index 0000000..2126deb --- /dev/null +++ b/account_move_line_filter_wizard/wizard/account_move_line_filter_view.xml @@ -0,0 +1,46 @@ + + + + + + + + + account_move_line_filter_wizard_form + account.move.line.filter.wizard + +
+ + + + + + +
+
+
+
+
+ + + Journal Items of Account + account.move.line.filter.wizard + form + new + + + + + +
+