Meet Vaishnani
Meet Vaishnani

Reputation: 253

Stop creating mail message and Followers in perticular model in odoo

When I create new sale order,it also creates the mail messages and followers at bottom of form view.

But I want to make that system should not create mail message and followers while users creates or writes data of "sale.order" model.

How can I stop such message and followers creation .?

Upvotes: 2

Views: 1252

Answers (2)

Sudhanshu Gupta
Sudhanshu Gupta

Reputation: 331

If you just want to remove it from the view then override the template and remove the fields named:

  • message_follower_ids
  • message_ids

These two fields are responsible for the view part.

Code to remove the fields:

<xpath expr="//field[@name='message_follower_ids']" position="replace"/>

Will this be fine or should I tell you how to update the record at model level?

Upvotes: 1

Meet Vaishnani
Meet Vaishnani

Reputation: 253

Just need to apply context in create and write method of that model.

@api.model
def create(self,vals):
    res=super(sale_order,self.with_context({'mail_create_nosubscribe':True,'tracking_disable':True})).create(vals)
    return res

@api.multi 
def write(self,vals):
    res=super(sale_order,self.with_context({'mail_create_nosubscribe':True,'tracking_disable':True})).write(vals)
    return res

Upvotes: 3

Related Questions