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

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


아바타
취소
작성자

any help... still waiting for this.

베스트 답변

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!

아바타
취소
관련 게시물 답글 화면 활동
1
3월 25
2500
4
8월 24
3949
1
1월 24
3640
1
1월 24
1754
1
12월 23
2579