콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1900 화면

Hello,

in Enterprises version,

I have configured the incoming email server to receive the email leads. But I am receiving all the emails received on that email. Including noreply,marketing,and etc.

Hence, I have write an automation python code mentioned below to delete those emails. I have researched that we can set the record rule for that. but, it will filter the email not deleted those kind of email.


Automation:




Python Code:


exclude_keywords = ['noreply','no-reply', 'do-not-reply', 'donotreply','notifications','odoo.com','odoo','update','update@', 'spam', 'marketing', 'newsletter', 'promotions', 'offers', 'auto', 'automated', 'unmonitored','notifications@', 'noreply@', 'no-reply@', 'donotreply@', 'marketing@', 'newsletter@', 'promo@', 'offer@', 'auto@', 'automated@']


if record.model == 'crm.lead':

    sender_email=record.email_from.lower()


    if not any(keyword in sender_email for keyword in exclude_keywords):

        crm=env['crm.lead'].browse(record.id)

        if crm and not crm.description:

            crm['description']=record.body

    else:

        

        crm=env['crm.lead'].browse(record.id)

        crm.unlink()

        record.unlink()

아바타
취소
관련 게시물 답글 화면 활동
1
9월 24
4839
0
1월 22
3097
0
3월 15
5224
2
7월 24
2321
1
5월 24
2754