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

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?

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

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 9 25
1855
2
thg 9 25
341
1
thg 8 25
1790
1
thg 5 25
1458
0
thg 4 25
1300