From 2d68dd89febe2162c9435afb0a74447e4d0efcc0 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Tue, 4 Dec 2012 11:30:42 +0530 Subject: [PATCH] [IMP]crm:onchange method for opportunity to set phone,mobile,sales team and partner bzr revid: kbh@tinyerp.com-20121204060042-dgr2ibddolhk5yzg --- addons/crm/crm_phonecall.py | 12 ++++++++++++ addons/crm/crm_phonecall_view.xml | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py index da08f97250a..a0ef56010e5 100644 --- a/addons/crm/crm_phonecall.py +++ b/addons/crm/crm_phonecall.py @@ -155,6 +155,18 @@ class crm_phonecall(base_state, osv.osv): }) return partner_id + def on_change_opportunity(self, cr, uid, ids, opportunity_id, context=None): + values = {} + if opportunity_id: + opportunity = self.pool.get('crm.lead').browse(cr, uid, opportunity_id, context=context) + values = { + 'section_id' : opportunity.section_id and opportunity.section_id.id or False, + 'partner_phone' : opportunity.phone, + 'partner_mobile' : opportunity.mobile, + 'partner_id' : opportunity.partner_id and opportunity.partner_id.id or False, + } + return {'value' : values} + def _call_set_partner(self, cr, uid, ids, partner_id, context=None): write_res = self.write(cr, uid, ids, {'partner_id' : partner_id}, context=context) self._call_set_partner_send_note(cr, uid, ids, context) diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml index 3b5162288a4..896bf8c9ee0 100644 --- a/addons/crm/crm_phonecall_view.xml +++ b/addons/crm/crm_phonecall_view.xml @@ -75,7 +75,7 @@ - +