From 38ce3783483229a7a418c4484cc4ea79adbbf6ec Mon Sep 17 00:00:00 2001 From: david Date: Wed, 20 Nov 2019 18:37:56 +0100 Subject: [PATCH] [FIX] mass_mailing_partner: prevent singleton error --- mass_mailing_partner/__manifest__.py | 2 +- mass_mailing_partner/wizard/partner_mail_list_wizard.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mass_mailing_partner/__manifest__.py b/mass_mailing_partner/__manifest__.py index f528523..413d359 100644 --- a/mass_mailing_partner/__manifest__.py +++ b/mass_mailing_partner/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Link partners with mass-mailing", - "version": "12.0.1.0.1", + "version": "12.0.1.0.2", "author": "Tecnativa, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/social", diff --git a/mass_mailing_partner/wizard/partner_mail_list_wizard.py b/mass_mailing_partner/wizard/partner_mail_list_wizard.py index 0977e3d..2978bc6 100644 --- a/mass_mailing_partner/wizard/partner_mail_list_wizard.py +++ b/mass_mailing_partner/wizard/partner_mail_list_wizard.py @@ -22,9 +22,9 @@ class PartnerMailListWizard(models.TransientModel): contact_obj = self.env['mail.mass_mailing.contact'] partners = self.partner_ids - add_list = partners.filtered(lambda r: r.mass_mailing_contact_ids) - if add_list: - add_list.mass_mailing_contact_ids[0].list_ids |= self.mail_list_id + add_list = partners.filtered('mass_mailing_contact_ids') + for partner in add_list: + partner.mass_mailing_contact_ids[0].list_ids |= self.mail_list_id to_create = partners - add_list for partner in to_create: