@api.onchange('name') def _chyanjg_gb(self): for line in self: jl = self.env['kucun.xiejxx'].search([('name', '=', line.name)], limit=1) if len(jl)==0: line.chuyanjg='无信息' elif len(jl)==2: line.xjxx_id=jl.id line.chuyanjg = '合格' else: return { 'warning': { 'title': "异常", 'message': "信息异常", } }