From 61a34dd8a5d817e46697385f31180904d29c50d0 Mon Sep 17 00:00:00 2001 From: David Beguin Date: Tue, 28 Aug 2018 14:07:57 +0200 Subject: [PATCH] [IMP] crm : add is partner blacklisted in crm.lead Since the mass mailing blacklist, it's possible to see if a contact is blacklisted using the blacklist_mixin.is_blacklisted. As crm.lead.opportunity view is displaying one of the two fields email_from and partner_address_email and is_blacklisted is computed on email_from, it was necessary to add a related fields that read the is_blacklisted value of the related partner to see directly of the opportunity is blacklisted or not. --- addons/crm/models/crm_lead.py | 1 + addons/crm/views/crm_lead_views.xml | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index 43fb9c795aa..972e0e7a15c 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -111,6 +111,7 @@ class Lead(models.Model): partner_address_name = fields.Char('Partner Contact Name', related='partner_id.name', readonly=True) partner_address_email = fields.Char('Partner Contact Email', related='partner_id.email', readonly=True) partner_address_phone = fields.Char('Partner Contact Phone', related='partner_id.phone', readonly=True) + partner_is_blacklisted = fields.Boolean('Partner is blacklisted', related='partner_id.is_blacklisted', readonly=True) company_currency = fields.Many2one(string='Currency', related='company_id.currency_id', readonly=True, relation="res.currency") user_email = fields.Char('User Email', related='user_id.email', readonly=True) user_login = fields.Char('User Login', related='user_id.login', readonly=True) diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml index 55e0080cdaf..44f3cd677d1 100644 --- a/addons/crm/views/crm_lead_views.xml +++ b/addons/crm/views/crm_lead_views.xml @@ -506,14 +506,23 @@ 'default_phone': phone, 'default_mobile': mobile, 'default_email': email_from, 'default_user_id': user_id, 'default_team_id': team_id, 'default_website': website}"/> - - + +