Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Add a Mailing contact automatically to a mailing list

Subscribe

Get notified when there's activity on this post

This question has been flagged
pythonautomatedmailingodoo.shv12
12 Replies
14522 Views
Avatar
Chris Leray

Hi,I am trying to find a way using an automated action to add contact to a specific mailing list once the contact has been created into Mailing contact.

I created an automated action to create a contact to Maling list contact as soon as a new contact is added, this is working fine: https://ibb.co/HdpsNJv

But I can't find a way to add this contact to a specific mailing list.  I tried that but it does not work: https://ibb.co/wSg1S6Y

Any advice?  thanks 


1
Avatar
Discard
Avatar
Pierre de Giorgio
Best Answer

For Odoo 12 you can try putting all of this is python code. This is how I did it. I also do a quick check to make sure the email address doesn’t exist before creating the new entry. If you do it as outlined in the above example, try changing the line for the mailing lists from [1,2] to ([6,0,[1,2])]. That should eliminate the need for the second automated action.

My example also eliminates the need for the second automated example.

Hope this helps.

contact_name = record.name
contact_email = record.email
contact_company = record.parent_id.name

ref_model = env[‘mail.mass_mailing.contact’]
existing_records = env[‘mail.mass_mailing.contact’].search([(’email’, ‘=’, contact_email)])
if len(existing_records) == 0:
new_entry = ref_model.create({‘name’:contact_name, ’email’:contact_email,’company_name’:contact_company,’list_ids’ : [(6,0,[1])]})

2
Avatar
Discard
Chris TRINGHAM

Thanks Pierre, that's an improvement on my solution!

Tim Drinkwater

Any tips on how to modify this to work with the crm.lead model in 16 with a server action? Trying to add to a mailing list via the marketing automation app.

Avatar
Mike Lorusso
Best Answer

Hi

There's a third-party app that adds contacts to mailing lists. It also has an action "Add contact to Mailing list". Perhaps this might help you?

Cheers

Mike

0
Avatar
Discard
Chris Leray
Author

thanks for your feedback. I'd like to avoir adding or buyingt an extra module. I ll keep digging otherwise I will go for a specific module then.

thanks

Chris Leray
Author

HI,

thanks for that.

Indeed it is not the best app as many app in Odoo, the are far from being compltete and need a lot of customization.

That's for me the pb with odoo system, many app but not complete unfortunately. But it does the job eventually.

cheers

Avatar
Chris TRINGHAM
Best Answer

I think I have found a solution in Odoo 13.  Let's assume that you want to add the contact to two mailing lists that have Record IDs of 1 & 2.

FieldEvaluation TypeValue

Name (mailing.contact)

Python expression

record.name

Email (mailing.contact)

Python expression

record.email

Mailing Lists (mailing.contact)

Python expression

[1,2]

If you want to add them to Mailing Lists 1,2 & 7 then the Python expression would be [1,2,7]

Screenshots and more information

EDIT: As noted in the comments, this does not work in Odoo 12, so here is a workaround

Create another Automated Action to be triggered when a record is created on Mass Mailing Contact (mail.mass_mailing.contact) - so immediately after the first Automated Action (above):

  • Model = Mass Mailing Contact (mail.mass_mailing.contact)
  • Action To Do = Execute Python Code
  • Trigger Condition = On Creation
  • Apply on = Mailing Lists is not set
      [["list_ids","=",False]]
    Python Code
    record['list_ids'] = [1,2]
    0
    Avatar
    Discard
    Chris Leray
    Author

    Hi,

    thanks for your feedback.

    I had a loot at the doc and I have tried this before but it still does now work.

    I am using v12 and indeed the model name is a bit different, as you can see but it looks the same:

    https://ibb.co/y4z8RCX

    There is no error message but it does not work. I have tried to split it into different automated action too but still the same.

    I really don't get it, this is weird.I agree it should work this way.

    Is there a way to track the log and see what it is executed in therm of query when the automated action is triggered?

    I don't see anything fro,m the log file..

    thank for your help, love the odootricks.tips :)

    Chris TRINGHAM

    Yes, although it's working in Odoo 13, I can't make it work in Odoo 12, which is strange!!

    Chris TRINGHAM

    Updated my answer with a workaround. I guess that someone with better Python knowledge could do all of this in one Automated Action :-)

    Chris Leray
    Author

    Thanks a lot, it is indeed working this way.

    cheers

    Avatar
    HsuMonKo
    Best Answer

    Hi, may i know the name of third-party app that adds contacts to mailing lists .

    0
    Avatar
    Discard
    Chris TRINGHAM

    https://apps.odoo.com/apps/modules/12.0/mass_mailing_partner/

    Chris Leray
    Author

    Thanks,m I managed to do it through automated action

    Enjoying the discussion? Don't just read, join in!

    Create an account today to enjoy exclusive features and engage with our awesome community!

    Sign up
    Related Posts Replies Views Activity
    Automated action with python expression Solved
    action python automated odoo.sh v12
    Avatar
    Avatar
    6
    Mar 24
    10716
    Grant portal access automatically when contact is created Solved
    automated portal-user odoo.sh v12
    Avatar
    Avatar
    Avatar
    Avatar
    Avatar
    4
    Oct 24
    12112
    How to use "import <module>" in automated action in Odoo.sh 11.0? Solved
    action python automated automation odoo.sh
    Avatar
    Avatar
    Avatar
    2
    Apr 25
    19007
    How to code Automated Action to update a ManytoOne custom field to match source field?
    automated v12
    Avatar
    Avatar
    2
    Jul 19
    6685
    Add newly created Leads to Newsletter Mailing List
    automated mailing crm.lead
    Avatar
    0
    Jul 23
    2314
    Community
    • Tutorials
    • Documentation
    • Forum
    Open Source
    • Download
    • Github
    • Runbot
    • Translations
    Services
    • Odoo.sh Hosting
    • Support
    • Upgrade
    • Custom Developments
    • Education
    • Find an Accountant
    • Find a Partner
    • Become a Partner
    About us
    • Our company
    • Brand Assets
    • Contact us
    • Jobs
    • Events
    • Podcast
    • Blog
    • Customers
    • Legal • Privacy
    • Security
    الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

    Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

    Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

    Website made with

    Odoo Experience on YouTube

    1. Use the live chat to ask your questions.
    2. The operator answers within a few minutes.

    Live support on Youtube
    Watch now