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.

21 lines
808 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 Tecnativa - Jairo Llopis
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  4. from odoo import _, api, models
  5. from odoo.exceptions import ValidationError
  6. class MassMailingContact(models.Model):
  7. _inherit = "mail.mass_mailing.contact"
  8. @api.constrains("partner_id", "list_id", "name", "email")
  9. def _check_no_manual_edits_on_fully_synced_lists(self):
  10. if self.env.context.get("syncing"):
  11. return
  12. if any((one.list_id.dynamic and
  13. one.list_id.sync_method == "full") for one in self):
  14. raise ValidationError(
  15. _("Cannot edit manually contacts in a fully "
  16. "synchronized list. Change its sync method or execute "
  17. "a manual sync instead."))