自定义模块中的 odoo 14 message_new
odoo 14 message_new in custom module
我创建了一个自定义模块来接收邮件传入的邮件。配置接收邮件服务器后,我在帮助台中使用创建票证对其进行了测试,但是当我使用我的模块时,没有任何反应,没有收到日志,我没有错
感谢您的帮助
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, msg, custom_values=None):
_logger.warning('hi i am message_new')
return super(TestMailer, self).message_new(msg_dict, custom_values=defaults)
我想你忘了在这个方法中调用 super...
我创建了一个自定义模块来接收邮件传入的邮件。配置接收邮件服务器后,我在帮助台中使用创建票证对其进行了测试,但是当我使用我的模块时,没有任何反应,没有收到日志,我没有错
感谢您的帮助
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, msg, custom_values=None):
_logger.warning('hi i am message_new')
return super(TestMailer, self).message_new(msg_dict, custom_values=defaults)
我想你忘了在这个方法中调用 super...