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

Hi Everyone,


I noticed that at the end of the view for Sales there is a "Messages and communication history" box.

Below the code:

<div class="oe_chatter">

<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>

<field name="message_ids" widget="mail_thread"/>

</div>


I created an personal action ( button). How is possible to automatically add a message in "oe_chatter" when someone click on my button?


Thank you a lot,


Selverine

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Try this code to send messages to all followers of the object:


        body = "My Message!"

       records = self._get_followers(cr, uid, ids, None, None, context=context) followers = records[ids[0]]['message_follower_ids'] self.message_post(cr, uid, ids, body=body, subtype='mt_comment', partner_ids=followers, context=context)


        

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

Hi Peter. It is exactly what I needed. Thank you a lot!

Hi Petter, do you know how to put this button on email template?so user get email with this button and when they click it, it return with auto reply to oe chatter

thank you

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

Dentro de tu clase, tienes que definir la siguiente función: 

def _track_subtype (self, init_values): 
self.ensure_one ()
if 'address_ids' in init_values:
self.message_post (body = "Domicilio Modificado",
partner_id = self.env.user .partner_id.id)
return self.env.ref ('my_model.mt_address_change')
return super (Name_class, self) ._ track_subtype (init_values) 

Y en el XML: 
<record id = "mt_address_change" model = "mail.message.subtype ">
<field name =" name "> Dirección confirmada </field>
<field name =" res_model "> my_model.model </field>
<field name ="predeterminado "eval =" True "/>
<field name = "description"> cambio de dirección! </field>
</record>

Revisar _track_subtype en : https://www.odoo.com/documentation/13.0/reference/mixins.html

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I need to write some messages with oe_chatter in the next objects and I'm not understanding how to do it.

event = request.env['calendar.event'].search([('id', '=', meeting_id)])

Anyone can help me?

Thanks!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

hi peter were can i add this code ?, because i have the same problem....

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
9
thg 10 15
8948
0
thg 3 15
4260
1
thg 6 25
1170
1
thg 6 25
765
1
thg 6 25
2406