Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
1587 มุมมอง

in this condition, i want to it keep creating the mail.message records, but NOT sending the email. 


class MailMessage(models.Model):    
​_inherit = 'mail.message'
​@api.model_create_multi
​def create(self, vals_list):
​​for vals in vals_list:
body = vals['body']
if isinstance(body, Markup):
body_text = Markup.unescape(body)
if body_text[:5] == "gpt: ":

please help, i cant find any solution that meet my requirement anywhere. thank you

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

no solution for this, so i need to revert back to codes that do "message_post" and then send the context like this :

        message_data = thread.message_post(
**{key: value for key, value in post_data.items() if key in self._get_allowed_message_post_params()}
).message_format()[0]

then i need to add context before it

thread = thread.with_context(active_test=True,mail_create_nosubscribe=False,mail_post_autofollow=False)
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.พ. 18
7048
1
ก.พ. 24
6338
6
ม.ค. 21
12311
1
ก.ค. 25
314
5
พ.ค. 25
17695