I'm writing a function that for searching record.
while I change the text of name fields I hope odoo will give back the record and post it.
I have refered to odoo origin code, but it did not work.
@api.multi
@api.onchange('name')
def _search_name(self):
if self._context.get('params')['action'] == 111:
return {
'res_id': self.env['yc.purchase'].search([('name', '=', self.name)]).id,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'yc.purchase',
'view_id': False,
'type': 'ir.actions.act_window',
}
I hope the url will from
"localhost:8069/web?debug#id=&view_type=form&model=yc.purchase&menu_id=273&action=111"
become
"localhost:8069/web?debug#id=XXX&view_type=form&model=yc.purchase&menu_id=273&action=111".
XXX is the id of record that I'd like to display.