如何打开带有过滤数据的模块?无效字段



我在这个模块中添加了一个模块"Base Candidat"base.candidat 我想打开特定canidate的应用程序(与候选人具有相同的电子邮件)我将此功能添加到base_candidat.py

def action_get_applications(self, cr, uid, ids, context=None):
    model, action_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'hr_recruitment', 'action_hr_job_applications')
    action = self.pool.get(model).read(cr, uid, action_id, context=context)
    email_ids = self.browse(cr, uid, ids[0], context).email_candidat
    candidature_ids = self.pool.get('hr.applicant').search(cr, uid, [('email_from', '=', email_ids)], context=context)
    action['context'] = {'default_res_model': self._name, 'default_res_id': ids[0]}
    action['domain'] = str([('candidature_ids', 'in', email_ids)])
    return action

我没有结果.有什么建议吗??

在odoo 8中,您可以尝试以下代码:

@api.multi
def action_get_candidatures(self):
    action_id = self.env.ref('hr_recruitment.action_hr_job_applications')
    action = action_id.read()[0]
    action['context'] = {'default_res_model': self._name, 'default_res_id': self.ids[0]}
    action['domain'] = str(['&', ('res_model', '=', self._name), ('email_from', '=', 'candidat01@exemple.com')])
    return action

最新更新