我有以下代码。当调度程序运行时,我收到错误消息。有人帮我解决代码中的错误Odoo运行发送预定邮件的cron作业时丢失错误
MissingError 您试图访问的文件之一已被删除,请刷新后再试一次。
def send_followup_mail(self, cr, uid, context=None):
quot_ids=self.search(cr, uid, [('state','=','amend_quote')])
for quot_id in quot_ids:
if quot_id:
quot_obj=self.browse(cr, uid, quot_id ,context=context)
quotation_since=quot_obj.quotation_since
for email_template_line in quot_obj.temp_tag_id.crm_campaign_id.email_template_ids:
if quotation_since==email_template_line.delay_days:
mail_pool = self.pool.get('mail.mail')
mail_id = self.pool.get('email.template').send_mail(cr, uid, email_template_line.id, 1, force_send=True, context=context)
if email_template_line.send_mail_to=='to_client':
mail_pool.write(cr, uid, mail_id, {'email_to':quot_obj.email_from}, context=context)
elif email_template_line.send_mail_to=='to_sale_rep':
mail_pool.write(cr, uid, mail_id, {'email_to':quot_obj.sale_rep_id.email}, context=context)
if mail_id:
mail_pool.send(cr, uid, mail_id, context=context)
self.write(cr, uid, quot_id,{'quotation_since':quotation_since+1}, context=None)
return True
这就是您从Odoo获得的所有错误消息吗?似乎你正在尝试使用那部分代码的一些记录,现在已经不在db了。 – CZoellner
我正面对这一行的错误 - mail_id = self.pool.get('email.template')。send_mail(cr,uid,email_template_line.id,1,force_send = True,context = context) – sfx
该参数' 1'告诉Odoo使用模板中定义的模型的ID为1的记录用于值表达式。似乎数据库中没有该特定模型的ID为1的记录。为什么该参数设置为1?它不应该是'quot_id'吗? – CZoellner