Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3851 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

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 Odpovědi Zobrazení Aktivita
1
srp 25
1531
1
kvě 25
1245
2
kvě 25
1370
0
dub 25
1109
1
bře 25
1597