[IMP]crm:onchange method for opportunity to set phone,mobile,sales team and partner
bzr revid: kbh@tinyerp.com-20121204060042-dgr2ibddolhk5yzg
This commit is contained in:
parent
67bb69500a
commit
2d68dd89fe
|
@ -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)
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<field name="user_id"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="create_date" invisible="1"/>
|
||||
<field name="opportunity_id" invisible="1"/>
|
||||
<field name="opportunity_id" invisible="1" on_change="on_change_opportunity(opportunity_id)"/>
|
||||
<field name="needaction_pending" invisible="1"/>
|
||||
<button string="Convert to Opportunity"
|
||||
name="%(phonecall2opportunity_act)d"
|
||||
|
@ -147,7 +147,7 @@
|
|||
domain="[('object_id.model', '=', 'crm.phonecall')]"/>
|
||||
<field name="partner_mobile"/>
|
||||
<field name="priority"/>
|
||||
<field name="opportunity_id"/>
|
||||
<field name="opportunity_id" on_change="on_change_opportunity(opportunity_id)"/>
|
||||
</group>
|
||||
|
||||
<field name="description" placeholder="Description..."/>
|
||||
|
|
Loading…
Reference in New Issue