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.
 
 
 
 

23 lines
948 B

# Copyright 2017 Tecnativa - Jairo Llopis
# Copyright 2019 Tecnativa - Victor M.M. Torres
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, models
from odoo.exceptions import ValidationError
class MassMailingContact(models.Model):
_inherit = "mail.mass_mailing.contact"
@api.constrains("partner_id", "list_ids", "name", "email")
def _check_no_manual_edits_on_fully_synced_lists(self):
if self.env.context.get("syncing"):
return
for rec in self:
if rec.list_ids:
if any(rec.list_ids.mapped('dynamic')) and (
rec.list_ids.mapped('sync_method').count("full") > 0):
raise ValidationError(
_("""Cannot edit manually contacts in a fully synchronized list.
Change its sync method or execute
a manual sync instead."""))