~school-dev-team/school-base-openerp-module/school-ampa-openerp-module

« back to all changes in this revision

Viewing changes to oerp_modules/school_center/res_partner_contact.py

  • Committer: pereerro
  • Date: 2013-12-01 10:34:22 UTC
  • Revision ID: pereerro-20131201103422-2mwxdj9bs2inw10d
[REF] Code reordered

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    account module for OpenERP
 
5
#    Copyright (C) 2010 Tecnoba S.L. (http://www.tecnoba.com)
 
6
#       Pere Ramon Erro Mas <pereerro@tecnoba.com> All Rights Reserved.
 
7
#
 
8
#
 
9
#    account_contact OpenERP module is free software: you can redistribute it and/or modify
 
10
#    it under the terms of the GNU General Public License as published by
 
11
#    the Free Software Foundation, either version 3 of the License, or
 
12
#    (at your option) any later version.
 
13
#
 
14
#    account_contact OpenERP module is distributed in the hope that it will be useful,
 
15
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
#    GNU General Public License for more details.
 
18
#
 
19
#    You should have received a copy of the GNU General Public License
 
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
#
 
22
##############################################################################
 
23
 
 
24
 
 
25
from osv import osv, fields
 
26
from datetime import datetime, date, timedelta
 
27
from tools.translate import _
 
28
from collections import defaultdict
 
29
import math
 
30
from membership.membership import STATE
 
31
import collections
 
32
 
 
33
class res_partner_contact(osv.osv):
 
34
    _inherit = 'res.partner.contact'
 
35
    
 
36
    def _get_phone(self, cr, uid, ids, field_name, arg, context=None):
 
37
        ret = {}
 
38
        for item in self.browse(cr, uid, ids):
 
39
            ret[item.id] = item.job_ids and item.job_ids[0].phone
 
40
        return ret
 
41
        
 
42
    _columns = {
 
43
        'direct_job_ids' : fields.one2many('res.partner.job', 'contact_id', string='Jobs',),
 
44
        'phone' : fields.function(_get_phone, type='char', size=60, method=True,),
 
45
    }
 
46
res_partner_contact()
 
47
  
 
48
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
49