Odoo Help

2

1
5 Answers
0
Avatar

Yenthe Van Ginneken เบลเยียม

--Yenthe Van Ginneken--
22921
| 9 9 12
Turnhout, เบลเยียม
--Yenthe Van Ginneken--

My Odoo training platform: https://www.oocademy.com
My Odoo blog: http://www.odoo.yenthevg.com/
My Twitter: https://twitter.com/Yenthe666

Yenthe Van Ginneken เบลเยียม
28/1/16 03:41


The final solution:

@api.multi def mdo_indienen(self): self.ensure_one() #Attach all people that are in the group user_ids = self.pool.get('res.users').search(self._cr, self._uid, []) user_ids_to_attach_as_chat_followers = []

for user_id in user_ids: flag = self.pool.get('res.users').has_group(self._cr, user_id, 'aa_sel_kempen.group_sel_manager') if flag is True: user_record = self.pool.get('res.users').browse(self._cr, self._uid, user_id) user_ids_to_attach_as_chat_followers.append(user_record.partner_id.id)

#Write on the record self.write({ 'state': 'aanvraag', 'message_follower_ids': user_ids_to_attach_as_chat_followers })

""" Write a notification message on the chatter of this MDO. This message should also be shown in the messages inbox for all admins. """ body = _(u'Er is een nieuwe MDO aanvraag ingediend voor de patiënt ' + self.mdo_patient_id.name + '.') return self.message_post(body=body, partner_ids = user_ids_to_attach_as_chat_followers


So I had to get the partner_ids in place of the user_ids (thank you Samantha!) and finally I had to add partner_ids = user_ids_to_attach_as_chat_followers so that the message is shown in the inbox for all added users (under Messaging).

1 ความคิดเห็น
Samantha Cruz ฟิลิปปินส์
28/1/16 21:32

Welcome :)

1
Samantha Cruz ฟิลิปปินส์
26/1/16 20:54

First of all, if you want to add a followers you should get their partner_ids not user_ids. Your self.message_post is not complete.

If you want to send a notification, below is an example:


             self.message_post(
cr, uid, False,
subject="Message Subject",
body= ("Message body."),
partner_ids = followers,
type='notification',
subtype=False,
context=context)

1 ความคิดเห็น
Yenthe Van Ginneken เบลเยียม
28/1/16 03:38

Thanks this gave me a global idea about how to do this, upvoted it!

0
Avatar

Ishit Mehta (ime)

--Ishit Mehta (ime)--

1542
| 1 1 1
--Ishit Mehta (ime)--
Ishit Mehta (ime)
14/6/19 02:19

For you question, I have a simpler way. Prepare a channel with the users you want to give access.

Now go to settings -> Technical settings -> Automated actions -> Create automated action -> select the model -> choose 'Add followers' option in ACTION TO DO. You can add followers or you can also add channels. You Can also use trigger conditions option.

Ask a Question
ป้ายกำกับ
Keep Informed
2 ผู้ติดตาม
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now