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

Hello,


I am trying to create a new record in a custom module on an incoming email.


I have overrided the new_message method like bellow, however, I get the error :


thread_id = thread.id
AttributeError: 'NoneType' object has no attribute 'id'


@api.model
def message_new(self, msg_dict, custom_values=None):
""" Overrides mail_thread message_new that is called by the mailgateway
through message_process.
This override updates the document according to the email.
"""
self = self.with_context(default_user_id=False)

if custom_values is None:
custom_values = {}
defaults = {
'name': self.env['ir.sequence'].next_by_code('service.complaints'),
'partner_id': msg_dict.get('author_id', False),
}
if 'body' in msg_dict:
body_msg = tools.html2plaintext(msg_dict['body'])
defaults.update(description=body_msg)
defaults.update(custom_values)
return super(ServiceComplaints, self).message_new(msg_dict, custom_values=defaults)


Any ideas ?


Thank you,

Alexandru Gagea

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ม.ค. 25
1363
How to receive incoming mail? แก้ไขแล้ว
4
ก.พ. 24
14429
1
ต.ค. 19
2895
3
พ.ค. 21
8419
0
ธ.ค. 19
3817