data.update(update_data)
self.write(cr, uid, ids, data, context=context)
return True
-
- def default_get(self, cr, uid, fields, context=None):
- res = super(calendar_event, self).default_get(cr, uid, fields, context=context)
- if context.get('active_model') == 'res.partner':
- if context.get('user_id'):
- res.update({'partner_ids' : [self.pool['res.users'].browse(cr, uid, context.get('user_id'), context=context).partner_id.id]})
-
- if context.get('active_model') == 'crm.lead':
- if context.get('partner_id'):
- res.update({'partner_ids' : [context.get('partner_id')]})
- return res
-
def _tz_get(self, cr, uid, context=None):
return [(x.lower(), x) for x in pytz.all_timezones]
'crm_view.xml',
- 'crm_phonecall_view.xml',
- 'crm_phonecall_menu.xml',
-
'crm_lead_view.xml',
'crm_lead_menu.xml',
'calendar_event_menu.xml',
+ 'crm_phonecall_view.xml',
+ 'crm_phonecall_menu.xml',
+
'report/crm_lead_report_view.xml',
'report/crm_phonecall_report_view.xml',
def on_change_partner_id(self, cr, uid, ids, partner_id, context=None):
values = {}
- phonecall_obj = self.pool.get('crm.phonecall')
if partner_id:
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
values = {
'fax': partner.fax,
'zip': partner.zip,
}
- call_ids = phonecall_obj.search(cr, uid, [('opportunity_id','in',ids)], context)
- phonecall_obj.write(cr, uid, call_ids, {'partner_id': partner_id}, context)
return {'value': values}
def on_change_user(self, cr, uid, ids, user_id, context=None):
context="{'default_opportunity_id': active_id, 'search_default_opportunity_id': active_id, 'default_partner_id': partner_id, 'default_duration': 1.0}" />
<button string="Schedule a Meeting" type="action"
name="%(calendar.action_calendar_event)d"
- context="{'partner_id': partner_id}"/>
+ context="{'default_partner_ids': partner_id and [partner_id]}"/>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<menuitem name="Scheduled Calls" id="menu_crm_case_phone_outbound"
parent="crm.menu_crm_case_phone"
- groups="crm.group_scheduled_calls_menu"
+ groups="crm.group_scheduled_calls"
action="crm_case_categ_phone_outgoing0"/>
</data>
help="""Allows you to use Sales Teams to manage your leads and opportunities."""),
'alias_prefix': fields.char('Default Alias Name for Leads'),
'alias_domain' : fields.char('Alias Domain'),
- 'group_scheduled_calls_menu': fields.boolean("Schedule calls to manage call center",
- implied_group='crm.group_scheduled_calls_menu',
+ 'group_scheduled_calls': fields.boolean("Schedule calls to manage call center",
+ implied_group='crm.group_scheduled_calls',
help="""This adds menu 'Scheduled Calls' under 'Sales / Phone Calls'""")
}
<label for="id" string="Pre-Sale Services"/>
<div>
<div>
- <field name="group_scheduled_calls_menu" class="oe_inline"/>
- <label for="group_scheduled_calls_menu"/>
+ <field name="group_scheduled_calls" class="oe_inline"/>
+ <label for="group_scheduled_calls"/>
</div>
</div>
</group>
class res_partner(osv.osv):
""" Inherits partner and adds CRM information in the partner form """
_inherit = 'res.partner'
+
+ def schedule_meeting(self, cr, uid, id, context=None):
+ user_id = context.get('user_id')
+ if user_id:
+ partner_id = self.pool.get('res.users').browse(cr, uid, user_id).partner_id.id
+ res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid, 'calendar', 'action_calendar_event', context)
+ res['context'] = {
+ 'default_partner_ids': user_id and [partner_id],
+ }
+ return res
def _opportunity_meeting_count(self, cr, uid, ids, field_name, arg, context=None):
res = dict(map(lambda x: (x,{'opportunity_count': 0, 'meeting_count': 0}), ids))
attrs="{'invisible': [('customer', '=', False)]}"
name="%(crm.crm_case_category_act_oppor11)d"
context="{'search_default_partner_id': active_id}"/>
- <button class="oe_inline" type="action"
- string="Schedule a Meeting"
- name="%(calendar.action_calendar_event)d"
- context="{'user_id': user_id}"/>
+ <button class="oe_inline" string="Schedule a Meeting" type="object"
+ name="schedule_meeting" context="{'user_id': user_id}"/>
<button class="oe_inline" type="action" string="Calls"
name="%(crm.crm_case_categ_phone_incoming0)d"
context="{'search_default_partner_id': active_id, 'default_duration': 1.0}" />
<field name="category_id" ref="base.module_category_hidden"/>
</record>
- <record id="group_scheduled_calls_menu" model="res.groups">
+ <record id="group_scheduled_calls" model="res.groups">
<field name="name">Show Scheduled Calls Menu</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>