Skip to Content
Menu
This question has been flagged
1 Reply
2903 Views

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?

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

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 Replies Views Activity
0
Nov 24
100
1
Aug 24
671
0
May 24
755
2
Jan 24
793
2
Dec 22
3545