You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
633 B
17 lines
633 B
# Copyright 2018 David Vidal <david.vidal@tecnativa.com>
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
|
|
from odoo import api, SUPERUSER_ID
|
|
|
|
|
|
def post_init_hook(cr, registry):
|
|
"""Ensure all existing contacts are going to work as v10"""
|
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
contacts = env['mail.mass_mailing.contact'].search([])
|
|
for contact in contacts:
|
|
if len(contact.list_ids) <= 1:
|
|
continue
|
|
list_1 = contact.list_ids[0]
|
|
for list_ in contact.list_ids - list_1:
|
|
contact.copy({"list_ids": [(6, 0, list_.ids)]})
|
|
contact.list_ids = list_1
|