[FIX] crm : Inconsistency when scheduling a call from an opportunity

lp bug: https://launchpad.net/bugs/689566 fixed

bzr revid: asr@tinyerp.com-20110628102536-cgjyefsqyme82qfk
This commit is contained in:
Ashutosh Srivastava (Open ERP) 2011-06-28 15:55:36 +05:30
parent eedefe1ebc
commit b0e033f261
2 changed files with 7 additions and 4 deletions

View File

@ -91,7 +91,7 @@ class crm_phonecall(crm_base, osv.osv):
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'priority': crm.AVAILABLE_PRIORITIES[2][0],
'state': _get_default_state,
'user_id': lambda self,cr,uid,ctx: uid,
#'user_id': lambda self,cr,uid,ctx: uid,
'active': 1,
}

View File

@ -126,7 +126,7 @@ class crm_opportunity2phonecall(osv.osv_memory):
'categ_id' : this.categ_id.id,
'description' : opp.description or False,
'date' : this.date,
'section_id' : this.section_id.id or opp.section_id.id or False,
'section_id' : this.section_id.id or False,
'partner_id': opp.partner_id and opp.partner_id.id or False,
'partner_address_id': opp.partner_address_id and opp.partner_address_id.id or False,
'partner_phone' : opp.phone or (opp.partner_address_id and opp.partner_address_id.phone or False),
@ -134,7 +134,9 @@ class crm_opportunity2phonecall(osv.osv_memory):
'priority': opp.priority,
'opportunity_id': opp.id
}
new_case = phonecall_obj.create(cr, uid, vals, context=context)
if this.action == 'schedule':
phonecall_obj.case_open(cr, uid, [new_case])
elif this.action == 'log':
@ -142,14 +144,15 @@ class crm_opportunity2phonecall(osv.osv_memory):
value = {
'name': _('Phone Call'),
'domain': "[('user_id','=',%s),('opportunity_id','=',%s)]" % (uid,opp.id),
#'domain': "[('user_id','=',%s),('opportunity_id','=',%s)]" % (uid,opp.id),
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'crm.phonecall',
'res_id' : new_case,
'views': [(id3, 'form'), (id2, 'tree'), (False, 'calendar')],
'type': 'ir.actions.act_window',
'search_view_id': res['res_id']
'search_view_id': res['res_id'],
'context':context,
}
return value