[IMP]: crm: Improvement in default_get for opportunity and phonecall to phonecall wizards
bzr revid: rpa@tinyerp.com-20100319110115-ieufxtyu7yipkxzk
This commit is contained in:
parent
cebfc5b7e8
commit
f5bac7a41d
|
@ -49,11 +49,14 @@ class crm_opportunity2phonecall(osv.osv_memory):
|
|||
|
||||
opp_obj = self.pool.get('crm.opportunity')
|
||||
record_ids = context and context.get('active_ids', []) or []
|
||||
res = {}
|
||||
res = super(crm_opportunity2phonecall, self).default_get(cr, uid, fields, context=context)
|
||||
for opp in opp_obj.browse(cr, uid, record_ids, context=context):
|
||||
res['name'] = opp.name
|
||||
res['user_id'] = opp.user_id and opp.user_id.id or False
|
||||
res['section_id'] = opp.section_id and opp.section_id.id or False
|
||||
if 'name' in fields:
|
||||
res.update({'name': opp.name})
|
||||
if 'user_id' in fields:
|
||||
res.update({'user_id': opp.user_id and opp.user_id.id or False})
|
||||
if 'section_id' in fields:
|
||||
res.update({'section_id': opp.section_id and opp.section_id.id or False})
|
||||
return res
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
|
|
|
@ -115,15 +115,19 @@ class crm_phonecall2phonecall(osv.osv_memory):
|
|||
|
||||
@return : default values of fields.
|
||||
"""
|
||||
res = super(crm_phonecall2phonecall, self).default_get(cr, uid, fields, context=context)
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
if record_id:
|
||||
phonecall = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
|
||||
res = {
|
||||
'name': phonecall.name,
|
||||
'user_id': phonecall.user_id and phonecall.user_id.id or False,
|
||||
'date': phonecall.date,
|
||||
'section_id': phonecall.section_id and phonecall.section_id.id or False
|
||||
}
|
||||
if 'name' in fields:
|
||||
res.update({'name': phonecall.name})
|
||||
if 'user_id' in fields:
|
||||
res.update({'user_id': phonecall.user_id and phonecall.user_id.id or False})
|
||||
if 'date' in fields:
|
||||
res.update({'date': phonecall.date})
|
||||
if 'section_id' in fields:
|
||||
res.update({'section_id': phonecall.section_id and phonecall.section_id.id or False})
|
||||
|
||||
return res
|
||||
|
||||
crm_phonecall2phonecall()
|
||||
|
|
Loading…
Reference in New Issue