From bd60fdc0e282c962e017e541ac6aeada15229446 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Wed, 25 May 2022 17:48:20 +0200 Subject: [PATCH] Avoid duplicated emails in party and contact mechanism default email issue11506 review427221003 (grafted from bc92627b6fc9be0da22fb51ba50ee7db4f228fe3) --HG-- branch : 6.0 --- ir.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ir.py b/ir.py index 3196ae5ff4..e8baf016fa 100644 --- a/ir.py +++ b/ir.py @@ -51,6 +51,18 @@ class EmailTemplate(metaclass=PoolMeta): return super().email_models() + [ 'party.party', 'party.contact_mechanism'] + @classmethod + def _get_default_exclude(cls, record): + pool = Pool() + Party = pool.get('party.party') + ContactMechanism = pool.get('party.contact_mechanism') + exclude = super()._get_default_exclude(record) + if isinstance(record, Party): + exclude.append('contact_mechanisms') + if isinstance(record, ContactMechanism): + exclude.append('party') + return exclude + @classmethod def _get_address(cls, record): pool = Pool()