콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
15305 화면

I have a custom module and some fields.

user_id = fields.Many2many('res.users', string="Responsible")#responsible user

When the record is created I want to send the popup message like "Enquiries are created".
Notes

please give the idea behind this.Thanks in advance


아바타
취소
작성자

Thanks, Amal. I will check the module.

작성자 베스트 답변

I get the solution of this problem.Here I share my code
Firstly call the send_to_channel method in create.Must create the channel between 2 users for activate the popup message functioanlity.

code sample

def send_to_channel(self, body, result):

         users = result.user_id

        ch_obj = self.env['mail.channel']

        body = body +' '+ result.seq_no

        if users:

            for user in users:

                ch_name = user.name+', '+self.env.user.name

                ch = ch_obj.sudo().search([('name', 'ilike', str(ch_name))])

                if not ch:

                    ch = ch_obj.sudo().search([('name', 'ilike', str(self.env.user.name+', '+user.name))])

            ch.message_post(attachment_ids=[],body=body,content_subtype='html',

                            message_type='comment',partner_ids=[],subtype='mail.mt_comment',

                            email_from=self.env.user.partner_id.email,author_id=self.env.user.partner_id.id)

        return True


아바타
취소

How to send direct message/chat to any user without using a channel?

When you send a message to another user for first time, a private channel it's created and sender and receiver are added to that channel. So when you send a message to another user, you are not sending a direct message, you are sending a message to a private channel.

관련 게시물 답글 화면 활동
5
9월 24
10478
1
12월 22
3710
2
9월 22
3070
5
9월 19
8218
1
11월 17
5595