[IMP] crm: Improve the view of phonecall2phonecall

bzr revid: sbh@tinyerp.com-20100308085519-g37drjpjsrs2jjoo
This commit is contained in:
sbh (Open ERP)
2010-03-08 14:25:19 +05:30
parent fcc3bc5a78
commit aa9a5fd933
2 changed files with 27 additions and 4 deletions
+22 -3
View File
@@ -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()
@@ -9,6 +9,10 @@
<form string="Schedule Other Call " col="2">
<field name="name"/>
<field name="user_id" />
<separator colspan="3" string="Contacts" />
<field name="partner_id"/>
<field name="address_id"/>
<separator colspan="3" string="" />
<field name="category_id" domain="[('object_id.model', '=', 'crm.phonecall')]" />
<field name="section_id"/>
<field name="notes"/>
@@ -26,7 +30,7 @@
<field name="view_mode">form</field>
<field name="view_id" ref="phonecall_to_phonecall_view"/>
<field name="target">new</field>
<field name="context">{'record_id' : False}</field>
<field name="context">{'record_id' : active_id}</field>
</record>
</data>
</openerp>