Skip to main content
 首页 » 编程设计

python之在 Odoo 10 中禁用自动添加合作伙伴作为关注者

2025年05月04日37dyllove98

如何停止在 Odoo 10 中自动将合作伙伴添加为关注者。每当我创建新报价或机会时,合作伙伴都会自动添加到关注者列表中,并向我不想要的合作伙伴发送电子邮件通知.

如何防止这种情况发生?

请您参考如下方法:

你可以用简单的方法做到这一点。

例如:

class sale_order(models.Model): 
    _inherit="sale.order" 
 
    @api.model 
    def create(self,vals): 
        res=super(sale_order,self.with_context('mail_create_nosubscribe':True)).create(vals) 
        return res 

如果您在上下文中传递ma​​il_create_nosubscribe True,系统将不会在消息中添加默认关注者。

Odoo is supporting mainly three type of keyword in the mail message context,using that you can enable/disable processes model wise.

1.tracking_disable:在创建和写入时,不执行任何 MailThread 功能(自动订阅、跟踪、发布...)

2.mail_create_nosubscribe : create 或 message_post 时,不订阅 记录线程的uid

3.mail_create_nolog : 创建时,不记录自动 ' 创建'消息

You need to just pass value in the context, system will disable above features.

这可能对您有所帮助。