[Fix] crm: Fix the problem of lead wizard
bzr revid: sbh@tinyerp.com-20100112101150-nsof11qkh4d40adi
This commit is contained in:
parent
b7cce4e704
commit
6a2a90d5ea
|
@ -23,9 +23,10 @@ import crm
|
|||
import crm_mailgate
|
||||
import crm_segmentation
|
||||
import crm_meeting
|
||||
import crm_opportunity
|
||||
import crm_lead
|
||||
import crm_phonecall
|
||||
import crm_opportunity
|
||||
|
||||
import crm_claim
|
||||
import crm_fundraising
|
||||
import crm_job
|
||||
|
|
|
@ -85,7 +85,7 @@ class crm_lead(osv.osv):
|
|||
"the partner mentality in relation to our services.The scale has" \
|
||||
"to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."),
|
||||
|
||||
'case_id': fields.many2one ('crm.case', 'Opportunity'),
|
||||
'opportunity_id': fields.many2one ('crm.opportunity', 'Opportunity'),
|
||||
}
|
||||
|
||||
def msg_new(self, cr, uid, msg):
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
<field name="categ_id" select="1" on_change="onchange_categ_id(categ_id)" string="Lead Source"/>
|
||||
<field name="category2_id" string="Campaign Type" select="1"/>
|
||||
<newline/>
|
||||
<field name="case_id" string="Opportunity Case"/>
|
||||
<field name="opportunity_id" string="Opportunity Case"/>
|
||||
<button string="Convert to Opportunity" name="%(wizard_crm_lead_opportunity_set)d" icon="gtk-index" type="action"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
|
|
|
@ -80,6 +80,7 @@ class crm_opportunity(osv.osv):
|
|||
'ref' : fields.reference('Reference', selection=_links_get, size=128),
|
||||
'ref2' : fields.reference('Reference 2', selection=_links_get, size=128),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'lead_id':fields.many2one ('crm.lead', 'Lead'),
|
||||
}
|
||||
|
||||
def msg_new(self, cr, uid, msg):
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
</group>
|
||||
<field name="date" string="Deadline"/>
|
||||
<group colspan="2">
|
||||
<field name="case_id" select="1"/>
|
||||
<field name="lead_id" select="1"/>
|
||||
<button string="Assign" name="%(action_crm_opportunity_assign_wizard)d" type="action" />
|
||||
</group>
|
||||
<button string="Schedule a Meeting"
|
||||
|
|
|
@ -96,14 +96,14 @@ class lead2opportunity(wizard.interface):
|
|||
|
||||
lead_case_obj = pool.get('crm.lead')
|
||||
opportunity_case_obj = pool.get('crm.opportunity')
|
||||
for lead in lead_case_obj.browse(cr, uid, data['ids']):
|
||||
for lead in lead_case_obj.browse(cr, uid, data['ids']):
|
||||
#TODO : Take other info from lead
|
||||
new_opportunity_id = opportunity_case_obj.create(cr, uid, {
|
||||
'name': data['form']['name'],
|
||||
'planned_revenue': data['form']['planned_revenue'],
|
||||
'probability': data['form']['probability'],
|
||||
'partner_id': data['form']['partner_id'],
|
||||
'case_id':lead.id,
|
||||
'lead_id':lead.id,
|
||||
})
|
||||
|
||||
new_opportunity = opportunity_case_obj.browse(cr, uid, new_opportunity_id)
|
||||
|
@ -111,12 +111,12 @@ class lead2opportunity(wizard.interface):
|
|||
vals = {
|
||||
'partner_id': data['form']['partner_id'],
|
||||
}
|
||||
if not lead.case_id:
|
||||
vals.update({'case_id' : new_opportunity.inherit_case_id.id})
|
||||
if not lead.opportunity_id:
|
||||
vals.update({'opportunity_id' : new_opportunity.id})
|
||||
|
||||
lead_case_obj.write(cr, uid, [lead.id], vals)
|
||||
lead_case_obj.case_cancel(cr, uid, [lead.id])
|
||||
opportunity_case_obj.case_open(cr, uid, [new_opportunity_id])
|
||||
# opportunity_case_obj.case_open(cr, uid, [new_opportunity_id])
|
||||
|
||||
value = {
|
||||
'name': _('Opportunity'),
|
||||
|
|
Loading…
Reference in New Issue