Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2539 Vistas

working in Technical -> Automation Rules

i have used below code to generate chatter message with Link its working fine, i but want to change default message, how i can do it? if i have to modify the default template then how i can modify it? what the template to modify, the name and path?

record.message_post_with_source(
        'mail.message_origin_link',
        render_values={'self': record, 'origin': new_stock_picking},
        subtype_xmlid='mail.mt_note',
    )

output screenshot:


please help.

regards


Avatar
Descartar
Autor

any help... still waiting for this.

Mejor respuesta

You can find an exemple in hr_expense module.

First, create a template that you will call in your message post with source like this: 

<template id="my_new_custom_template">
<p>The record <t t-out="name"/> has been refused</p>
<ul>
<li>Reason: <t t-out="reason"/></li>
</ul>
</template>

 Then,

subtype_id = self.env['ir.model.data']._xmlid_to_res_id('mail.mt_comment')
for record in self:
record.message_post_with_source(
      'my_module.my_new_custom_template',
      subtype_id='mail.mt_note',
      render_values={'reason': reason, 'name': record.name},
)


I hope this helps!

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
mar 25
2294
4
ago 24
3740
1
ene 24
3398
1
ene 24
1594
1
dic 23
2402