1 # -*- coding: utf-8 -*-
6 # Created by Nicolas Bessi based on Credric Krier contribution
8 # Copyright (c) 2009 CamptoCamp. All rights reserved.
9 ##############################################################################
10 # WARNING: This program as such is intended to be used by professional
11 # programmers who take the whole responsability of assessing all potential
12 # consequences resulting from its eventual inadequacies and bugs
13 # End users who are looking for a ready-to-use solution with commercial
14 # garantees and support are strongly adviced to contract a Free Software
17 # This program is Free Software; you can redistribute it and/or
18 # modify it under the terms of the GNU General Public License
19 # as published by the Free Software Foundation; either version 2
20 # of the License, or (at your option) any later version.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
27 # You should have received a copy of the GNU General Public License
28 # along with this program; if not, write to the Free Software
29 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 ##############################################################################
34 from osv import fields, osv
36 class res_partner(osv.osv):
37 _inherit = 'res.partner'
40 'ref_companies': fields.one2many('res.company', 'partner_id',
41 'Companies that refers to partner'),
50 class res_partner_bank(osv.osv):
51 _inherit = "res.partner.bank"
53 'name': fields.char('Description', size=128, required=True),
54 'post_number': fields.char('Post number', size=64),
55 'bvr_number': fields.char('BVR account number', size=11),
56 'bvr_adherent_num': fields.char('BVR adherent number', size=11),
57 'dta_code': fields.char('DTA code', size=5),
60 # def _default_value(self, cursor, user, field, context=None):
61 # if field in ('country_id', 'state_id'):
65 # if not context.get('address', False):
67 # for ham, spam, address in context['address']:
68 # if 'type' in address.keys() :
69 # if address['type'] == 'default':
70 # return address[field]
71 # elif not address['type']:
72 # value = address[field]
78 def name_get(self, cr, uid, ids, context=None):
81 bank_type_obj = self.pool.get('res.partner.bank.type')
83 type_ids = bank_type_obj.search(cr, uid, [])
85 for bank_type in bank_type_obj.browse(cr, uid, type_ids,
87 bank_type_names[bank_type.code] = bank_type.name
89 for r in self.read(cr, uid, ids, ['name','state'], context):
90 res.append((r['id'], r['name']+' : '+bank_type_names[r['state']]))
94 ('bvr_adherent_uniq', 'unique (bvr_adherent_num)', 'The BVR adherent number must be unique !')
97 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: