- This opens Meeting's calendar view to schedule meeting on current Opportunity
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Opportunity to Meeting IDs
- @param context: A standard dictionary for contextual values
-
- @return: Dictionary value for created Meeting view
- """
- data_obj = self.pool.get('ir.model.data')
- if context is None:
- context = {}
- value = {}
- for opp in self.browse(cr, uid, ids, context=context):
- # Get meeting views
- result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
- res = data_obj.read(cr, uid, result, ['res_id'], context=context)
- id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet')
- id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet')
- id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet')
- if id1:
- id1 = data_obj.browse(cr, uid, id1, context=context).res_id
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
- if id3:
- id3 = data_obj.browse(cr, uid, id3, context=context).res_id
-
- context = {
- 'default_partner_id': opp.partner_id and opp.partner_id.id or False,
- 'default_email_from': opp.email_from,
- 'default_state': 'open',
- 'default_name': opp.name
- }
- value = {
- 'name': ('Meetings'),
- 'domain': "[('user_id','=',%s)]" % (uid),
- 'context': context,
- 'view_type': 'form',
- 'view_mode': 'calendar,form,tree',
- 'res_model': 'crm.meeting',
- 'view_id': False,
- 'views': [(id1, 'calendar'), (id2, 'form'), (id3, 'tree')],
- 'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id'],
- 'nodestroy': True
- }
- return value
+ applicant = self.browse(cr, uid, ids[0], context)
+ category = self.pool.get('ir.model.data').get_object(cr, uid, 'hr_recruitment', 'categ_meet_interview', context)
+ res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid, 'base_calendar', 'action_crm_meeting', context)
+ res['context'] = {
+ 'default_partner_ids': applicant.partner_id and [applicant.partner_id.id] or False,
+ 'default_user_id': uid,
+ 'default_state': 'open',
+ 'default_name': applicant.name,
+ 'default_categ_ids': category and [category.id] or False,
+ }
+ return res