[ADD] select all candidate invoices by default in the payment order

This commit is contained in:
OpenERP instance user
2011-12-09 14:07:52 +01:00
parent d9c23da98d
commit 52125e3cfa
3 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1 @@
import payment_order

View File

@@ -0,0 +1,43 @@
##############################################################################
#
# Copyright (C) 2011 Therp BV (<http://therp.nl>).
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract EduSense BV
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Account Payment Invoice Selection Shortcut',
'version': '6.0.1.64',
'license': 'GPL-3',
'author': 'Therp BV',
'website': 'http://therp.nl',
'category': 'Banking addons',
'depends': ['account_payment'],
'init_xml': [],
'update_xml': [
],
'demo_xml': [],
'description': '''
When composing a payment order, select all candidates by default (in the second step of the "Select invoices to pay" wizard).
''',
'active': False,
'installable': True,
}

View File

@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from osv import osv, fields
class payment_order_create(osv.osv_memory):
_inherit = 'payment.order.create'
def default_get(self, cr, uid, fields_list, context=None):
"""
Automatically add the candidate move lines to
the payment order, instead of only applying them
to the domain.
We make use of the fact that the search_entries
method passes an action without a res_id so that a
new instance is created. Inject the line_ids, which have
been placed in the context at object
creation time.
"""
res = super(payment_order_create, self).default_get(
cr, uid, fields_list, context=context)
if (fields_list and 'entries' in fields_list
and 'entries' not in res
and context and context.get('line_ids', False)
):
res['entries'] = context['line_ids']
return res
payment_order_create()