Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5415 Lượt xem

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()

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 24
4366
1
thg 4 23
3757
0
thg 6 22
2934
1
thg 7 25
738
1
thg 6 25
1765