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 ##############################################################################
23 from tools.translate import _
25 class crm_phonecall2meeting(osv.osv_memory):
26 """ Phonecall to Meeting """
28 _name = 'crm.phonecall2meeting'
29 _description = 'Phonecall To Meeting'
31 def action_cancel(self, cr, uid, ids, context=None):
33 Closes Phonecall to Meeting form
34 @param self: The object pointer
35 @param cr: the current row, from the database cursor,
36 @param uid: the current user’s ID for security checks,
37 @param ids: List of Phonecall to Meeting IDs
38 @param context: A standard dictionary for contextual values
41 return {'type':'ir.actions.act_window_close'}
43 def action_make_meeting(self, cr, uid, ids, context=None):
45 This opens Meeting's calendar view to schedule meeting on current Phonecall
46 @param self: The object pointer
47 @param cr: the current row, from the database cursor,
48 @param uid: the current user’s ID for security checks,
49 @param ids: List of Phonecall to Meeting IDs
50 @param context: A standard dictionary for contextual values
52 @return : Dictionary value for created Meeting view
55 record_id = context and context.get('active_id', False) or False
58 phonecall_obj = self.pool.get('crm.phonecall')
59 data_obj = self.pool.get('ir.model.data')
62 result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
63 res = data_obj.read(cr, uid, result, ['res_id'])
64 id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet')
65 id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet')
66 id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet')
68 id1 = data_obj.browse(cr, uid, id1, context=context).res_id
70 id2 = data_obj.browse(cr, uid, id2, context=context).res_id
72 id3 = data_obj.browse(cr, uid, id3, context=context).res_id
74 phonecall = phonecall_obj.browse(cr, uid, record_id, context=context)
76 'default_phonecall_id': phonecall.id,
77 'default_partner_id': phonecall.partner_id and phonecall.partner_id.id or False,
78 'default_email': phonecall.email_from ,
79 'default_name': phonecall.name
83 'name': _('Meetings'),
84 'domain' : "[('user_id','=',%s)]" % (uid),
87 'view_mode': 'calendar,form,tree',
88 'res_model': 'crm.meeting',
90 'views': [(id1, 'calendar'), (id2, 'form'), (id3, 'tree')],
91 'type': 'ir.actions.act_window',
92 'search_view_id': res['res_id']
97 crm_phonecall2meeting()
99 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: