Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3769 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Autor

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

Related Posts Răspunsuri Vizualizări Activitate
2
iul. 25
398
0
dec. 24
999
2
oct. 24
1129
1
aug. 24
2267
2
iul. 24
1510