odoo 14 message_new 在自定义模块中

问题描述

我创建了一个自定义模块,用于接收邮件传入邮件。配置接收邮件服务器后,我使用帮助台中的创建票证对其进行了测试,但是当我使用我的模块时,没有任何反应没有收到日志我没有错

感谢您的帮助

from odoo import api,fields,models,tools,_
import logging
_logger = logging.getLogger(__name__)


class TestMailer(models.Model):
    _name = 'test.mailer'
    _inherit = ['mail.alias.mixin','mail.thread','mail.activity.mixin']
    _description = 'Sort Email'
    

    name = fields.Char(string='Name')
    email_from = fields.Char(string='email from')
    email_cc = fields.Char(string='email cc')
    mail_body = fields.Text(string='mail body')
    partner_id = fields.Many2one('res.partner','Partner',required=True,select=True)

    @api.model
    def message_new(msg_dict,custom_values=None):
    # def message_new(self,msg,custom_values=None):
        _logger.warning('hi i am message_new')

我现在在接收邮件服务器中获取时得到了这个。

odoo.addons.mail.models.mail_thread: Routing mail from "name" <name@email.com> to test_sort@email.net,"test_sort@email.net" <test_sort@email.net> with Message-Id <DBBPR08MB49043139E291E368A928E963EA0F9@DBBPR08MB4904.eurprd08.prod.outlook.com>: fallback to model:test.mailer,thread_id:None,custom_values:None,uid:2

阅读什么

Create a new record on Incoming Mails odoo

customize the auto lead creation through incoming emails

解决方

@api.model
    def message_new(self,custom_values=None):
        _logger.warning('hi i am message_new')
    return super(TestMailer,self).message_new(msg_dict,custom_values=defaults)


解决方法

我想你忘记了这个方法中的超级调用......