Hi all,
I need to display the contact name from lead and display it in Schedule Calls. May I know how to do it?
Many thanks.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi all,
I need to display the contact name from lead and display it in Schedule Calls. May I know how to do it?
Many thanks.
Your right, i understood it.. Hmm by the way try to do this.. in your .py inherit the crm.phonecall class and put the field contact name
class crm_phonecall(osv.osv):
_inherit = "crm.phonecall"
_columns = {
'contact_name': fields.char('Contact Name', size=64),
}
crm_phonecall()
and in your .xml add the contact_name field
<record id="call_contact_name" model="ir.ui.view">
<field name="name">call.contact.name</field>
<field name="model">crm.phonecall</field>
<field name="type">form</field>
<field name="priority">10</field>
<field name="inherit_id" ref="crm.crm_case_phone_form_view"/>
<field name="arch" type="xml">
<xpath expr ="//field[@name='date']" position="before">
<field name="contact_name"/>
</xpath>
</field>
</record>
Inherit the crm.lead class and get its "schedule_phonecall" method which is responsible 4 transferring tha data from lead to schedule calls.. Add the contact_name inside the "VALS"
class crm_lead(osv.osv):
_inherit = "crm.lead"
def schedule_phonecall(self, cr, uid, ids, schedule_time, call_summary, desc, phone, contact_name, user_id=False, section_id=False, categ_id=False, action='schedule', context=None):
"""
:param string action: ('schedule','Schedule a call'), ('log','Log a call')
"""
phonecall = self.pool.get('crm.phonecall')
model_data = self.pool.get('ir.model.data')
phonecall_dict = {}
if not categ_id:
res_id = model_data._get_id(cr, uid, 'crm', 'categ_phone2')
if res_id:
categ_id = model_data.browse(cr, uid, res_id, context=context).res_id
for lead in self.browse(cr, uid, ids, context=context):
if not section_id:
section_id = lead.section_id and lead.section_id.id or False
if not user_id:
user_id = lead.user_id and lead.user_id.id or False
vals = {
'name': call_summary,
'opportunity_id': lead.id,
'user_id': user_id or False,
'categ_id': categ_id or False,
'description': desc or '',
'date': schedule_time,
'section_id': section_id or False,
'partner_id': lead.partner_id and lead.partner_id.id or False,
'partner_phone': phone or lead.phone or (lead.partner_id and lead.partner_id.phone or False),
'partner_mobile': lead.partner_id and lead.partner_id.mobile or False,
'priority': lead.priority,
'contact_name':lead.contact_name
}
new_id = phonecall.create(cr, uid, vals, context=context)
phonecall.case_open(cr, uid, [new_id], context=context)
if action == 'log':
phonecall.case_close(cr, uid, [new_id], context=context)
phonecall_dict[lead.id] = new_id
self.schedule_phonecall_send_note(cr, uid, [lead.id], new_id, action, context=context)
return phonecall_dict
_columns = {
'contact_name': fields.char('Contact Name', size=64),
}
crm_lead()
Although the contact_name will not appear in this window
but in your schedule log calls menu.. it will appear, if you put contact_name in your lead form
Hi lhadiesleo, I think you misunderstanding what I need to modify it. For example, I put the name "Jessie" as Contact Name in Lead Form (your screen shot no 1) and I need the Contact Name "Jessie" display in Schedule Calls List, there don't have a field name to display the contact name. May I know how to do it, need to add on a new field name? Many thanks.
hope that will help you :D i've already tested it. and it works fine to me :D
A lead in OpenERP is a source of information that someone in your company needs to qualify before deciding if anyone should spend time and energy following up.
It could be a name from a list you bought, a business card from a tradeshow, an incoming email to your website, an email from a registration page, a message that a caller left, etc.
The out of the box workflow (ie: without customization) that the software supports is to convert a lead into an opportunity if call needs to be scheduled - then the contact information (person & company) will show up as you expect.
I understand what you want to do, and it is certainly is possible with customization, but this is my advice - convert the lead into an opportunity if you think it is worth a scheduled call.
Leave it a lead until someone spends time deciding if it is worth anyone's time following up. If you know enough to know when a return call should be scheduled (if someone has asked you to call back), you probably know enough to justify converting it into an opportunity.
Hi lhadiesleo,
Thanks for your help.
I open crm_phonecall.py and edit it as below (follow your screen shot no 1) but I got this error. "TypeError: The model "crm.phonecall" specifies an unexisting parent class "crm.phonecall". You may need to add a dependency on the parent class' module." I am newbie in python language. May I know how to solve this problem? Many thanks.
class crm_phonecall(base_state, osv.osv): """ Model for CRM phonecalls """ _name = "crm.phonecall" _description = "Phonecall" _order = "id desc" _inherit = ['mail.thread','crm.phonecall'] _columns = { # base_state required fields 'contact_name': fields.char('Contact Name', size=64), 'date_action_last': fields.datetime('Last Action', readonly=1), ...
just copy and paste my code.. i know it will work fine.. :D