代码之家  ›  专栏  ›  技术社区  ›  David González Blazman

“邮件”表中的“邮件id”列

  •  1
  • David González Blazman  · 技术社区  · 6 年前

    我正在用python编写一个外部应用程序,它使用odoo中的消息系统。 所以,我需要使用邮件和邮件通知表。

    我试图通过INSERT将元素单独放入表中,填充必要的元素以使其正常工作,它工作得很好,消息显示在Odoo中消息的“收件箱”中,通知显示正确。

    但是检查这个表中的其他字段,我发现消息id有一个标记格式(介于<>)和一系列数字(我没有找到任何相关性),后跟“-openerp-'res\id'-'model'-@'company”。

    有谁能告诉我这个领域的原因以及如何填补它?

    谢谢

    1 回复  |  直到 6 年前
        1
  •  0
  •   Rafael D Portilla    6 年前

    您可以在tools/mail.py中检查代码并执行类似的操作

    def generate_tracking_message_id(res_id):
        """Returns a string that can be used in the Message-ID RFC822 header field
    
           Used to track the replies related to a given object thanks to the "In-Reply-To"
           or "References" fields that Mail User Agents will set.
        """
        try:
            rnd = random.SystemRandom().random()
        except NotImplementedError:
            rnd = random.random()
        rndstr = ("%.15f" % rnd)[2:]
        return "<%.15f.%s-openerp-%s@%s>" % (time.time(), rndstr, res_id, socket.gethostname())