Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3986 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Autore

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

Post correlati Risposte Visualizzazioni Attività
3
set 25
1806
2
set 25
324
1
ago 25
1777
1
mag 25
1443
0
apr 25
1287