Skip to content Skip to sidebar Skip to footer

Disable Automatic Addition Of Partner As Follower In Odoo 10

How can I stop automatic addition of partners as followers in Odoo 10. Whenever I create a new quotation or opportunity, the partner is automatically added to the followers list an

Solution 1:

You can do it using simple method.

Ex:

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

If you pass mail_create_nosubscribe True in the context, system will not add default followers in the message.

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 : At create and write, perform no MailThread features (auto subscription, tracking, post, ...)

2.mail_create_nosubscribe : At create or message_post, do not subscribe uid to the record thread

3.mail_create_nolog : At create, do not log the automatic ' created' message

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

This may help you.

Solution 2:

Not enough reputation to post this as a comment, so it had to be an answer, sorry for that.

You answer set me well on my way, I changed the code a little bit to make it work for me.

classsale_order(models.Model):
    _inherit="sale.order"    @api.modeldefcreate(self, vals):    
            res = super(sale_order, self.with_context(mail_create_nosubscribe=True)).create(vals)

In addition, I noticed that the partner was still being added upon order confirmation. I resolved that with the following code:

@api.multidefaction_confirm(self):

        return_value = super(sale_order, self.with_context(mail_create_nosubscribe=True)).action_confirm()

        for follower in self['message_follower_ids']:
            follower.unlink()

        return return_value

Post a Comment for "Disable Automatic Addition Of Partner As Follower In Odoo 10"