1 # -*- encoding: utf-8 -*-
5 # Created by Nicolas Bessi based on Credric Krier contribution
7 # Copyright (c) 2010 CamptoCamp. All rights reserved.
8 ##############################################################################
9 # WARNING: This program as such is intended to be used by professional
10 # programmers who take the whole responsability of assessing all potential
11 # consequences resulting from its eventual inadequacies and bugs
12 # End users who are looking for a ready-to-use solution with commercial
13 # garantees and support are strongly adviced to contract a Free Software
16 # This program is Free Software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License
18 # as published by the Free Software Foundation; either version 2
19 # of the License, or (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 ##############################################################################
32 from osv import fields, osv
36 """Inherit res.bank class in order to add swiss specific field"""
39 ### Swiss unik bank identifier also use in IBAN number
40 'clearing': fields.char('Clearing number', size=64),
42 'city': fields.char('City', size=128, select=1),
48 class ResPartnerBank(osv.osv):
49 """Override of res.partner.bank"""
51 _inherit = "res.partner.bank"
54 'acc_number': fields.char(
58 help='Bank account number'
66 ## Post account code to be redesing
67 'post_number': fields.char(
70 help='CCP, postal account number used for '+
71 'postal payment format xx-xxxx-x'
73 ## Post account code to be redesing
74 'bvr_number': fields.char(
77 help='Postal account number of the '+
78 'financial establishment.'+
79 'Used foe BV bank payment '+
83 ## Post financne affiliation number
84 'bvr_adherent_num': fields.char(
85 'BVR adherent number',
87 help='PostFinance affiliation BVR number '+
88 'of your financial establishement'+
89 'used for BVR/ESR printing'
91 ## DTA code used by Mammuth
92 'dta_code': fields.char(
95 help='Code used by transfer system for '+
96 'identify the bank. Ex Mammuth'
98 ### Will print the Bank name on BVR/ESR
99 'printbank' : fields.boolean(
101 help='will print bank name on the ESR/BVR'
103 ### Will print the Bank account on BVR/ESR
104 'printaccount' : fields.boolean(
105 'Print Account Number on BVR',
106 help='will print bank account'+
107 'name on the ESR/BVR'
111 def name_get(self, cursor, uid, ids, context=None):
112 """Override of the name get function of the bank
113 in order to have the partner link to the bank"""
116 bank_type_obj = self.pool.get('res.partner.bank.type')
118 type_ids = bank_type_obj.search(cursor, uid, [])
120 for bank_type in bank_type_obj.browse(cursor, uid, type_ids,
122 bank_type_names[bank_type.code] = bank_type.name
124 for bank in self.read(cursor, uid, ids, ['name', 'state'], context):
125 res.append((bank['id'], bank['name']+
126 ' : '+bank_type_names[bank['state']]))
130 ('bvr_adherent_uniq', 'unique (bvr_adherent_num)',
131 'The BVR adherent number must be unique !')