0

我是开放式 ERP 7 中的 Vaibhav 新手,在继承 hr_recruitment 模块时出错。

我覆盖了 hr_recruitment 的搜索方法以过滤掉应用程序 我在 hr_job 和 hr_applicant 中添加了 job_code char 字段和 job_code_applicant

我的代码是:

def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
    ''' Overriden search method'''
    cur_obj=self.pool.get('hr.job')
    cr.execute('SELECT job_code FROM hr_job ')
    list = cr.fetchall()
    ids =  [ i[0] for i in list]
    cr.execute('SELECT id FROM hr_applicant WHERE job_code_applicant IN %s', (tuple(set(ids)),))
    list12 = cr.fetchall()
    ids_applicant =  [ i[0] for i in list12 ]
    return ids_applicant

错误是:

回溯(最近一次通话最后):

File "/home/fabian/openerp-7.0-20130408-232357/openerp/netsvc.py", line 293, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/home/fabian/openerp-7.0-20130408-232357/openerp/service/web_services.py", line 626, in dispatch
res = fn(db, uid, *params)
File "/home/fabian/openerp-7.0-20130408-232357/openerp/osv/osv.py", line 188, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/home/fabian/openerp-7.0-20130408-232357/openerp/osv/osv.py", line 131, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/fabian/openerp-7.0-20130408-232357/openerp/osv/osv.py", line 197, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/fabian/openerp-7.0-20130408-232357/openerp/osv/osv.py", line 185, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/fabian/openerp-7.0-20130408-232357/openerp/osv/orm.py", line 2697, in read_group
d['__domain'] = [(groupby, '=', alldata[d['id']][groupby] or False)] + domain

关键错误:8

4

1 回答 1

0

在您的代码中,为什么不返回搜索方法的超级而不是返回直接 ID?

喜欢:

def search(self, cr, uid, args, offset=0, limit=None, order=None,
                       context=None, count=False):
    #''' Overriden search method'''
    cur_obj=self.pool.get('hr.job')
    cr.execute('SELECT job_code '\
                 'FROM hr_job '\
              )
    list = cr.fetchall()
    ids =  [ i[0] for i in list]
    if ids:
        args.append(('job_code_applicant', 'in', ids))    

return super(hr_applicant, self).search(cr, uid, args, offset, limit, order, context, count)
于 2013-05-06T08:44:24.253 回答