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

Normally the mail body from a incoming lead mail (POP3) is stored into the chatter messagebox. How can I store it in the description field in crm.lead?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Override 

def message_new(self, msg_dict, custom_values=None):

method in the crm.lead model

Check this for reference: https://github.com/odoo/odoo/blob/12.0/addons/project/models/project.py#L847

อวตาร
ละทิ้ง
ผู้เขียน

I managed it another way:

body = remove_html_tags(self.message_ids[0].body)

self.description = body

def remove_html_tags(text):

"""Remove html tags from a string"""

import re

clean = re.compile('<.*?>')

return re.sub(clean, '', text)

You can use `from odoo.tools import html2plaintext` to remove tags

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ก.ย. 25
1848
2
ก.ย. 25
339
1
ส.ค. 25
1788
1
พ.ค. 25
1455
0
เม.ย. 25
1295