1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
22 from osv import fields, osv
24 from datetime import datetime, timedelta
25 from datetime import datetime, timedelta
27 class crm_opportunity(osv.osv):
28 _name = 'crm.opportunity'
30 class crm_phonecall(osv.osv):
31 _name = 'crm.phonecall'
33 class crm_meeting(osv.osv):
35 _description = "Meeting Cases"
37 _inherit = ["crm.case", "calendar.event"]
40 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
41 'categ_id': fields.many2one('crm.case.categ', 'Meeting Type', \
42 domain="[('object_id.model', '=', 'crm.meeting')]", \
44 'phonecall_id':fields.many2one ('crm.phonecall', 'Phonecall'),
45 'opportunity_id':fields.many2one ('crm.opportunity', 'Opportunity'),
46 'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel', 'event_id', 'attendee_id', 'Attendees'),
51 class calendar_attendee(osv.osv):
52 _inherit = 'calendar.attendee'
54 def _compute_data(self, cr, uid, ids, name, arg, context):
56 result = super(calendar_attendee, self)._compute_data(cr, uid, ids, name, arg, context)
58 for attdata in self.browse(cr, uid, ids, context=context):
61 if name == 'categ_id':
63 model, res_id = tuple(attdata.ref.split(','))
64 model_obj = self.pool.get(model)
65 obj = model_obj.read(cr, uid, res_id, ['categ_id'])[0]
66 result[id][name] = obj.get('categ_id')
68 result[id][name] = False
71 'categ_id': fields.function(_compute_data, method=True, string='Event Type', type="many2one", relation="crm.case.categ", multi='categ_id'),
75 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: