Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
5347 Visualizzazioni

Hi

Please, how can i use property force_send=True in the model mail.mail in send()

mail  self  .env[  'mail.mail'  ] .sudo().create(content).send()

Avatar
Abbandona
Risposta migliore

Hiii, asmaa

Like this, you add force_send=True

def action_post(self):
res = super(AccountMove, self).action_post()
template = self.env.ref('your template id')
for rec in self:
if rec.partner_id.email:
template.send_mail(rec.id, force_send=True)
return res
Avatar
Abbandona
Risposta migliore

Hi asmaa,

You can use force_send parameter in the send_mail method of the mail.template model not in the mail.mail

Template will create a mail and schedule it for the next execution. if you pass force_send=True, then the mail will execute instantly and no schedule will added.

      sale_order_template_id.send_mail(record_id, force_send=True)

For send method of the mail.mail, it will execute and send the mail directly if you have not added the schedule_date in it.


Hope it will help you.

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
ott 24
4282
1
apr 23
3687
0
giu 22
2890
1
lug 25
643
1
giu 25
1679