Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
4751 Lượt xem

We have a model with a chatter and creating records.

For all (by code) newly created records the current user is automatically set as following to the record.

How to avoid this automatic subscription behavior in Odoo14/15?

Ảnh đại diện
Huỷ bỏ
Tác giả

During the meanwhile I figured out a solution.
When the model is being created an additional context can be used like this:
self.env['mymodel'].with_context(mail_create_nosubscribe=True).create(vals)

Tác giả Câu trả lời hay nhất

I added message_is_follower in create method:

self.env['mymodel'].create({
       'message_is_follower': False,
       ....

Which was not working...


-------------------------------------

SOLUTION:

This code prevents automatic follow assignment of the current user during creating new database records.

self.env['mymodel'].with_context(mail_create_nosubscribe=True).create(vals)


Ảnh đại diện
Huỷ bỏ

Could you post a bit more of the script you tried?

Câu trả lời hay nhất

When you set the properties of the record set 'message_is_follower': False

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 25
1538
2
thg 12 24
2516
0
thg 11 24
1632
0
thg 1 25
2698
1
thg 10 23
2864