如何解决此错误:找不到记录无法复制?

2024-03-29 11:44:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我想将申请者附件复制到自定义模块候选数据库我遇到以下错误: 注册#63 de候选碱基非trouv\xe9,不可能复制 (英文:找不到记录不能复制)

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

Tags: inselfidobjappidsuidattachment