Navigation

    Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

    Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

    由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

    本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

    开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

    如果您登录系统碰到问题,请在微信公众号留言:

    odoo message_post

    Odoo 新手求助
    4
    5
    2575
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      hui last edited by

      想要实现的效果:
      只给指定的用户发送消息,在消息墙显示,并且能显示在Inbox中。

      尝试:
      1、odoo中message_post()方法发送消息时,能显示在Inbox中,但是是发送给所有关注者,即使添加接受消息的用户,日志会提示,2017-09-23 19:24:12,084 6988 WARNING 0731 odoo.models: mail.message.create() inc ludes unknown fields: receiver。代码如下:

          def _send_assign_msg(self):
              context = self._context or {}
              receiver = context.get('receiver', False)
              base_url = self.sudo().env['ir.config_parameter'].get_param('web.base.url')
              action = self.env.ref('sps_product.product_template_action_all')
              ctx = {}
              ctx.update(receiver=receiver, base_url=base_url, action=action)
              msg = Template(part_assign_msg).render(object=self, ctx=ctx)
              subject = Template(part_assign_sub).render(object=self, ctx=ctx)
              self.message_post(receiver=receiver, body=msg, subject=subject, message_type='comment', subtype='mt_comment',  content_subtype='html')
      

      2、send_email()方法可以指定接收人,但是发送的消息只在消息强展示,不会在Inbox中展示,发送内部email代码简写如下():

      template.with_context(receiver=receiver, old_status=self.state, status=state, base_url=base_url, action=action, today=fields.Date.today()).send_mail(self.id, force_send=True)
      

      问题产生:
      不知道如何解决,源码中有个mail_post_autofollow这个字段,放在context中的,应该是接受消息的用户,我在context中重写了这个字段,还是不能实现我想要的效果?

      求助。。。Thanks in advance.

      1 Reply Last reply Reply Quote 0
      • 袭
        袭流苏2amor last edited by

        @1234567 在 odoo message_post 中说:

        你这种高亮的代码是怎么发送的,学习下一只都不会。

        1 Reply Last reply Reply Quote 0
        • 卓忆
          卓忆 last edited by 卓忆

          这个社区支持使用MarkDown语法。

          0_1506749886052_e17753fd-d0dd-4426-a8d8-981fdcb51a68-image.png

          代码用

          def abc()
          
          

          包裹起来

          0_1506749959586_da92bef8-b034-40b4-9192-96bbeddf4ac7-image.png

          行内的 用 def abc

          1 Reply Last reply Reply Quote 0
          • 袭
            袭流苏2amor last edited by

            万分感谢,之前都是截图 = =

            1 Reply Last reply Reply Quote 0
            • U
              user last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • First post
                Last post