我有以下代碼。當調度程序運行時,我收到錯誤消息。有人幫我解決代碼中的錯誤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