~acysos-team/account-payment/account-payment-sepa-6.1

« back to all changes in this revision

Viewing changes to account_payment_export/model/payment_mode.py

  • Committer: Ignacio Ibeas - Acysos S.L.
  • Date: 2014-02-09 15:09:33 UTC
  • Revision ID: ignacio@acysos.com-20140209150933-t2plsu9efwvhqtcd
[ADD] SEPA modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
 
5
#              (C) 2011 - 2013 Therp BV (<http://therp.nl>).
 
6
#            
 
7
#    All other contributions are (C) by their respective contributors
 
8
#
 
9
#    All Rights Reserved
 
10
#
 
11
#    This program is free software: you can redistribute it and/or modify
 
12
#    it under the terms of the GNU Affero General Public License as
 
13
#    published by the Free Software Foundation, either version 3 of the
 
14
#    License, or (at your option) any later version.
 
15
#
 
16
#    This program is distributed in the hope that it will be useful,
 
17
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
#    GNU Affero General Public License for more details.
 
20
#
 
21
#    You should have received a copy of the GNU Affero General Public License
 
22
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
23
#
 
24
##############################################################################
 
25
 
 
26
from openerp.osv import orm, fields
 
27
 
 
28
 
 
29
class payment_mode(orm.Model):
 
30
    ''' Restoring the payment type from version 5,
 
31
    used to select the export wizard (if any) '''
 
32
    _inherit = "payment.mode"
 
33
 
 
34
    def suitable_bank_types(self, cr, uid, payment_mode_id=None, context=None):
 
35
        """ Reinstates functional code for suitable bank type filtering.
 
36
        Current code in account_payment is disfunctional.
 
37
        """
 
38
        res = []
 
39
        payment_mode = self.browse(
 
40
            cr, uid, payment_mode_id, context)
 
41
        if (payment_mode and payment_mode.type and
 
42
            payment_mode.type.suitable_bank_types):
 
43
            res = [t.code for t in payment_mode.type.suitable_bank_types]
 
44
        return res