Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
3889 Weergaven

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**

Avatar
Annuleer
Beste antwoord

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

Avatar
Annuleer
Auteur

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

Gerelateerde posts Antwoorden Weergaven Activiteit
2
jul. 25
496
0
dec. 24
1105
2
okt. 24
1211
1
aug. 24
2363
2
jul. 24
1609