Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
4010 Visninger

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
Kassér
Bedste svar

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
Kassér
Forfatter

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 Besvarelser Visninger Aktivitet
3
sep. 25
1867
2
sep. 25
354
1
aug. 25
1797
1
maj 25
1466
0
apr. 25
1302