[MERGE] lp:~openerp-dev/openobject-addons/trunk-bug-1038189-kbh-new

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

bzr revid: vta@openerp.com-20121205133723-97su5a0ulgc1prg1
This commit is contained in:
vta vta@openerp.com 2012-12-05 14:37:23 +01:00
commit 6a6b0127ef
2 changed files with 15 additions and 3 deletions

View File

@ -157,6 +157,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)

View File

@ -145,7 +145,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..."/>
</sheet>
@ -176,7 +176,7 @@
invisible="1"/>
<field name="state" 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)"/>
<button string="Schedule Other Call"
icon="terp-call-start"
name="%(phonecall_to_phonecall_act)d"
@ -236,4 +236,4 @@
</record>
</data>
</openerp>
</openerp>