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

i need to send notification when i create new employee, the mail going well but i need to take the employee name to the mail body
that is my code

    @api.model
    def create(self, vals):
        result = super(hr_employee, self).create(vals)
        noti = {'subject': "new member are coming",
        'body': "MR( " + str(
        self.ar_name) + " ) has been one of our team"}
        result.message_post(
            message_type='notification',
            subtype='mail.mt_comment',
            partner_ids=[1],
            **noti
        )
    return result

i get the name = False
and the is an examble

**MR( False ) has been one of our team
--
Administrator**

아바타
취소
베스트 답변

Hi,

Instead of  self.ar_name try vals['ar_name']

  def create(self, vals):
result = super(hr_employee, self).create(vals)
noti = {'subject': "new member are coming",
'body': "MR( " + str(
vals['ar_name']) + " ) has been one of our team"}
result.message_post(
message_type='notification',
subtype='mail.mt_comment',
partner_ids=[1],
**noti
)
return result


Thanks

아바타
취소
작성자

thanks dear , it worked well , can you tell me briefly the difference between self and vals

관련 게시물 답글 화면 활동
2
7월 25
183
0
12월 24
954
2
10월 24
1080
1
8월 24
2196
2
7월 24
1465