[MERGE] [IMP] crm: improved call / meeting buttons and behavior on lead and partner form view.
- improved behavior of schedule a meeting, for both opportunities and partner, with correct attendees and options; - removed wizard to schedule a cal, jumping to the list view with correct default values is sufficient; - scheduled calls is now accessible using a group, accessible through sales configuration; bzr revid: tde@openerp.com-20140417145645-cpohfrfpqnskpok6
This commit is contained in:
commit
04c809e9f6
|
@ -72,20 +72,18 @@ Dashboard for CRM will include:
|
|||
|
||||
'wizard/crm_phonecall_to_phonecall_view.xml',
|
||||
|
||||
'wizard/crm_opportunity_to_phonecall_view.xml',
|
||||
|
||||
'wizard/crm_merge_opportunities_view.xml',
|
||||
|
||||
'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',
|
||||
|
||||
|
|
|
@ -898,21 +898,22 @@ class crm_lead(format_address, osv.osv):
|
|||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
def action_makeMeeting(self, cr, uid, ids, context=None):
|
||||
def action_schedule_meeting(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Open meeting's calendar view to schedule meeting on current opportunity.
|
||||
:return dict: dictionary value for created Meeting view
|
||||
"""
|
||||
opportunity = self.browse(cr, uid, ids[0], context)
|
||||
lead = self.browse(cr, uid, ids[0], context)
|
||||
res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid, 'calendar', 'action_calendar_event', context)
|
||||
partner_ids = [self.pool['res.users'].browse(cr, uid, uid, context=context).partner_id.id]
|
||||
if lead.partner_id:
|
||||
partner_ids.append(lead.partner_id.id)
|
||||
res['context'] = {
|
||||
'default_opportunity_id': opportunity.id,
|
||||
'default_partner_id': opportunity.partner_id and opportunity.partner_id.id or False,
|
||||
'default_partner_ids' : opportunity.partner_id and [opportunity.partner_id.id] or False,
|
||||
'default_user_id': uid,
|
||||
'default_section_id': opportunity.section_id and opportunity.section_id.id or False,
|
||||
'default_email_from': opportunity.email_from,
|
||||
'default_name': opportunity.name,
|
||||
'default_opportunity_id': lead.type == 'opportunity' and lead.id or False,
|
||||
'default_partner_id': lead.partner_id and lead.partner_id.id or False,
|
||||
'default_partner_ids': partner_ids,
|
||||
'default_section_id': lead.section_id and lead.section_id.id or False,
|
||||
'default_name': lead.name,
|
||||
}
|
||||
return res
|
||||
|
||||
|
|
|
@ -103,9 +103,9 @@
|
|||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box" name="buttons">
|
||||
<button string="Schedule/Log Call"
|
||||
name="%(opportunity2phonecall_act)d"
|
||||
type="action"/>
|
||||
<button class="oe_inline" type="action" string="Calls"
|
||||
name="%(crm.crm_case_categ_phone_incoming0)d"
|
||||
context="{'default_opportunity_id': active_id, 'search_default_opportunity_id': active_id, 'default_partner_id': partner_id, 'default_duration': 1.0}"/>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
|
@ -278,8 +278,8 @@
|
|||
<t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
|
||||
<t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
|
||||
<li><a name="%(mail.action_email_compose_message_wizard)d" type="action">Send Email</a></li>
|
||||
<li><a name="%(opportunity2phonecall_act)d" type="action">Schedule/Log Call</a></li>
|
||||
<li><a name="action_makeMeeting" type="object">Schedule Meeting</a></li>
|
||||
<li><a type="action" name="%(crm.crm_case_categ_phone_incoming0)d" >Calls</a></li>
|
||||
<li><a name="action_schedule_meeting" type="object">Schedule Meeting</a></li>
|
||||
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -389,11 +389,11 @@
|
|||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box">
|
||||
<button string="Schedule/Log Call" type="action"
|
||||
name="%(opportunity2phonecall_act)d"/>
|
||||
<button string="Meeting" type="object"
|
||||
name="action_makeMeeting"
|
||||
context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/>
|
||||
<button class="oe_inline" type="action" string="Calls"
|
||||
name="%(crm.crm_case_categ_phone_incoming0)d"
|
||||
context="{'default_opportunity_id': active_id, 'search_default_opportunity_id': active_id, 'default_partner_id': partner_id, 'default_duration': 1.0}"/>
|
||||
<button class="oe_inline" string="Schedule a Meeting" type="object"
|
||||
name="action_schedule_meeting" context="{'partner_id': partner_id}"/>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
|
|
|
@ -144,7 +144,8 @@
|
|||
|
||||
<menuitem name="Scheduled Calls" id="menu_crm_case_phone_outbound"
|
||||
parent="crm.menu_crm_case_phone"
|
||||
action="crm_case_categ_phone_outgoing0" />
|
||||
groups="crm.group_scheduled_calls"
|
||||
action="crm_case_categ_phone_outgoing0"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
help="Phone Calls Assigned to the current user or with a team having the current user as team leader"/>
|
||||
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
|
||||
<field name="user_id"/>
|
||||
<field name="opportunity_id"/>
|
||||
<field name="section_id" string="Sales Team"
|
||||
groups="base.group_multi_salesteams"/>
|
||||
<group expand="0" string="Group By...">
|
||||
|
|
|
@ -69,6 +69,9 @@ class crm_configuration(osv.TransientModel):
|
|||
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': fields.boolean("Schedule calls to manage call center",
|
||||
implied_group='crm.group_scheduled_calls',
|
||||
help="""This adds the menu 'Scheduled Calls' under 'Sales / Phone Calls'""")
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -9,9 +9,18 @@
|
|||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<div name="config_sale" position="before">
|
||||
<separator string="After-Sale Services"/>
|
||||
<separator string="Sale Services"/>
|
||||
<group>
|
||||
<label for="id" string="Pre-Sale Services"/>
|
||||
<div>
|
||||
<div>
|
||||
<field name="group_scheduled_calls" class="oe_inline"/>
|
||||
<label for="group_scheduled_calls"/>
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
<label for="id" string="Features"/>
|
||||
<label for="id" string="After-Sale Services"/>
|
||||
<div>
|
||||
<div>
|
||||
<field name="module_crm_claim" class="oe_inline"/>
|
||||
|
|
|
@ -92,5 +92,17 @@ class res_partner(osv.osv):
|
|||
opportunity_ids[partner_id] = opportunity_id
|
||||
return opportunity_ids
|
||||
|
||||
def schedule_meeting(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
partner_ids = list(ids)
|
||||
partner_ids.append(self.pool.get('res.users').browse(cr, uid, uid).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_id': ids and ids[0] or False,
|
||||
'default_partner_ids': partner_ids,
|
||||
}
|
||||
return res
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -94,13 +94,11 @@
|
|||
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="Meetings"
|
||||
name="%(calendar.action_calendar_event)d"
|
||||
context="{'search_default_partner_ids': active_id, 'default_partner_ids' : [active_id]}"/>
|
||||
<button class="oe_inline" string="Schedule a Meeting" type="object"
|
||||
name="schedule_meeting" context="{'partner_id': active_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}" />
|
||||
context="{'search_default_partner_id': active_id, 'default_duration': 1.0}"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
|
||||
<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>
|
||||
|
||||
<record model="res.users" id="base.user_root">
|
||||
<field eval="[(4,ref('base.group_partner_manager'))]" name="groups_id"/>
|
||||
</record>
|
||||
|
|
|
@ -31,23 +31,17 @@
|
|||
-
|
||||
Now I begin communication and schedule a phone call with the customer.
|
||||
-
|
||||
!python {model: crm.opportunity2phonecall}: |
|
||||
!python {model: crm.phonecall2phonecall}: |
|
||||
import time
|
||||
context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_3')]})
|
||||
context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_3')],'active_id': ref('crm_case_3')})
|
||||
call_id = self.create(cr, uid, {'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'name': "Bonjour M. Jean, Comment allez-vous? J'ai bien reçu votre demande, pourrions-nous en parler quelques minutes?"}, context=context)
|
||||
self.action_schedule(cr, uid, [call_id], context=context)
|
||||
-
|
||||
I check that phonecall is scheduled for that opportunity.
|
||||
-
|
||||
!python {model: crm.phonecall}: |
|
||||
ids = self.search(cr, uid, [('opportunity_id', '=', ref('crm_case_3'))])
|
||||
assert len(ids), 'Phonecall is not scheduled'
|
||||
-
|
||||
Now I schedule meeting with customer.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.action_makeMeeting(cr, uid, [ref('crm_case_3')])
|
||||
self.action_schedule_meeting(cr, uid, [ref('crm_case_3')])
|
||||
-
|
||||
After communicated with customer, I put some notes with contract details.
|
||||
-
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
import crm_partner_binding
|
||||
import crm_phonecall_to_phonecall
|
||||
import crm_opportunity_to_phonecall
|
||||
import crm_lead_to_opportunity
|
||||
import crm_merge_opportunities
|
||||
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
|
||||
import time
|
||||
|
||||
class crm_opportunity2phonecall(osv.osv_memory):
|
||||
"""Converts Opportunity to Phonecall"""
|
||||
_inherit = 'crm.phonecall2phonecall'
|
||||
_name = 'crm.opportunity2phonecall'
|
||||
_description = 'Opportunity to Phonecall'
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
opp_obj = self.pool.get('crm.lead')
|
||||
categ_id = False
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
try:
|
||||
res_id = data_obj._get_id(cr, uid, 'crm', 'categ_phone2')
|
||||
categ_id = data_obj.browse(cr, uid, res_id, context=context).res_id
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
record_ids = context and context.get('active_ids', []) or []
|
||||
res = {}
|
||||
res.update({'action': 'log', 'date': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
for opp in opp_obj.browse(cr, uid, record_ids, context=context):
|
||||
if 'name' in fields:
|
||||
res.update({'name': opp.name})
|
||||
if 'user_id' in fields:
|
||||
res.update({'user_id': opp.user_id and opp.user_id.id or False})
|
||||
if 'section_id' in fields:
|
||||
res.update({'section_id': opp.section_id and opp.section_id.id or False})
|
||||
if 'categ_id' in fields:
|
||||
res.update({'categ_id': categ_id})
|
||||
if 'partner_id' in fields:
|
||||
res.update({'partner_id': opp.partner_id and opp.partner_id.id or False})
|
||||
if 'contact_name' in fields:
|
||||
res.update({'contact_name': opp.partner_id and opp.partner_id.name or False})
|
||||
if 'phone' in fields:
|
||||
res.update({'phone': opp.phone or (opp.partner_id and opp.partner_id.phone or False)})
|
||||
return res
|
||||
|
||||
def action_schedule(self, cr, uid, ids, context=None):
|
||||
value = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
phonecall = self.pool.get('crm.phonecall')
|
||||
opportunity_ids = context and context.get('active_ids') or []
|
||||
opportunity = self.pool.get('crm.lead')
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
call_ids = opportunity.schedule_phonecall(cr, uid, opportunity_ids, data.date, data.name, \
|
||||
data.note, data.phone, data.contact_name, data.user_id and data.user_id.id or False, \
|
||||
data.section_id and data.section_id.id or False, \
|
||||
data.categ_id and data.categ_id.id or False, \
|
||||
action=data.action, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Opportunity to Phonecall view -->
|
||||
|
||||
<record model="ir.ui.view" id="opportunity2phonecall_view">
|
||||
<field name="name">crm.opportunity2phonecall.form</field>
|
||||
<field name="model">crm.opportunity2phonecall</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Schedule/Log a Call" version="7.0">
|
||||
<group>
|
||||
<group>
|
||||
<field name="action"/>
|
||||
<field name="name"/>
|
||||
<field name="categ_id" string="Type"
|
||||
widget="selection"
|
||||
domain="[('object_id.model', '=', 'crm.phonecall')]"
|
||||
groups="base.group_no_one"/>
|
||||
<field name="date" string="Planned Date" attrs="{'invisible': [('action','=','log')]}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="partner_id" readonly="True"/>
|
||||
<field name="phone"/>
|
||||
<field name="user_id" attrs="{'invisible': [('action','=','log')]}" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_salesman_all_leads']}"/>
|
||||
<field name="section_id" widget="selection" attrs="{'invisible': [('action','=','log')]}" groups="base.group_multi_salesteams"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="note" placeholder="Call Description" />
|
||||
<footer>
|
||||
<button name="action_schedule" type="object" string="Log call" attrs="{'invisible' : [('action', '!=', 'log')]}" class="oe_highlight"/>
|
||||
<button name="action_schedule" type="object" string="Schedule Call" attrs="{'invisible' : [('action', '!=', 'schedule')]}" class="oe_highlight" />
|
||||
or
|
||||
<button name="action_cancel" string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Opportunity to Phonecall action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="opportunity2phonecall_act">
|
||||
<field name="name">Schedule/Log Call</field>
|
||||
<field name="res_model">crm.opportunity2phonecall</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="opportunity2phonecall_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue