I'm trying to get 'title' automatically when customer will select. can anyone help me?
class res_partner(osv.osv):
_name = 'project.task'
_inherit = 'project.task'
_columns = {
'partner_id': fields.many2one('res.partner', string='Employees', groups='base.group_user'),
'title':fields.char('Tte'),
}
def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
if partner_id:
partner_id = self.pool.get('res.partner').browse(cr, uid, title, context=context)
return {'value': {'title': partner_id.title,}}
return {'value':{}}
xml::
<field name="partner_id" on_change="onchange_partner_id(title,partner_id)"/>
<field name="title" on_change="onchange_partner_id(title,partner_id)"/>