我想将申请人附件复制到自定义模块candidat_base我收到此错误: Enregistrement#63 de candidat.base non trouv \ xe9,copie不可能 (英文:找不到记录不能复制)
def _application2(self, cr, uid, ids, fields, arg, context=None):
app_obj = self.pool.get('hr.applicant')
Attachment = self.pool.get('ir.attachment')
app_id = {}
for cand in self.browse(cr, uid, ids, context=context):
app_id = app_obj.search(cr, uid, [('email_from', 'like', cand.email_candidat)], context=context)
attachment_ids = Attachment.search(cr, uid, [('res_model', '=', 'hr.applicant'), ('res_id', 'in', app_id)], context=context)
for attachment in Attachment.browse(cr, uid, attachment_ids, context=context):
Attachment.copy(cr, uid, attachment.id, default={'name': attachment.name}, context=context)
return True