From aa9a5fd93385c4ea174e7da0ca32f0d6a2458649 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Mon, 8 Mar 2010 14:25:19 +0530 Subject: [PATCH] [IMP] crm: Improve the view of phonecall2phonecall bzr revid: sbh@tinyerp.com-20100308085519-g37drjpjsrs2jjoo --- addons/crm/wizard/crm_phonecall2phonecall.py | 25 ++++++++++++++++--- addons/crm/wizard/crm_phonecall2phonecall.xml | 6 ++++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/addons/crm/wizard/crm_phonecall2phonecall.py b/addons/crm/wizard/crm_phonecall2phonecall.py index 4513a0bc23c..b6ba9f9b4c3 100644 --- a/addons/crm/wizard/crm_phonecall2phonecall.py +++ b/addons/crm/wizard/crm_phonecall2phonecall.py @@ -40,14 +40,15 @@ class crm_phonecall2phonecall(osv.osv_memory): def action_apply(self, cr, uid, ids, context=None): this = self.browse(cr, uid, ids)[0] - record_id = context and context.get('record_id', False) or False values={} values['name']=this.name values['user_id']=this.user_id and this.user_id.id - values['category_id']=this.category_id and this.category_id.id + values['categ_id']=this.category_id and this.category_id.id values['section_id']=this.section_id and this.section_id.id or False, values['description']=this.notes + values['partner_id']=this.partner_id + values['partner_address_id']=this.address_id.id phonecall_proxy = self.pool.get('crm.phonecall') phonecall_id = phonecall_proxy.create(cr, uid, values, context=context) value = { @@ -66,7 +67,25 @@ class crm_phonecall2phonecall(osv.osv_memory): 'user_id' : fields.many2one('res.users',"Assign To"), 'deadline': fields.datetime('Deadline', readonly=True), 'category_id' : fields.many2one('crm.case.categ','Category',domain="[('object_id.model', '=', ''crm.phonecall')]"), - 'section_id':fields.many2one('crm.case.section','Section Id'), + 'section_id':fields.many2one('crm.case.section','Sales Team'), + 'partner_id': fields.many2one('res.partner', 'Partner'), + 'address_id': fields.many2one('res.partner.address', 'Partner Contact', domain="[('partner_id','=',partner_id)]"), 'notes' : fields.text('Notes'), } + def default_get(self, cr, uid, fields, context=None): + record_id = context and context.get('record_id', False) or False + res = super(crm_phonecall2phonecall, self).default_get(cr, uid, fields, context=context) + + if record_id: + phonecall_id = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context) + print ":::::::::",phonecall_id.section_id.id + res['name']=phonecall_id.name + res['user_id']=phonecall_id.user_id and phonecall_id.user_id.id + res['section_id']=phonecall_id.section_id and phonecall_id.section_id.id + res['notes']=phonecall_id.description and phonecall_id.description + res['category_id']=phonecall_id.categ_id and phonecall_id.categ_id.id + res['partner_id']=phonecall_id.partner_id and phonecall_id.partner_id.id + res['address_id']=phonecall_id.partner_address_id and phonecall_id.partner_address_id.id + + return res crm_phonecall2phonecall() \ No newline at end of file diff --git a/addons/crm/wizard/crm_phonecall2phonecall.xml b/addons/crm/wizard/crm_phonecall2phonecall.xml index 82d7f60132b..c9a9d37ac9e 100644 --- a/addons/crm/wizard/crm_phonecall2phonecall.xml +++ b/addons/crm/wizard/crm_phonecall2phonecall.xml @@ -9,6 +9,10 @@
+ + + + @@ -26,7 +30,7 @@ form new - {'record_id' : False} + {'record_id' : active_id} \ No newline at end of file