Reputation: 253
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
Reputation: 331
If you just want to remove it from the view then override the template and remove the fields named:
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
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