From 38625a33a550032f46e975c158b8396c6d07e02c Mon Sep 17 00:00:00 2001 From: Priyanka Kakadiya Date: Tue, 20 Oct 2020 11:23:51 +0000 Subject: [PATCH 1/6] [IMP] crm: clean lead form view about Marketing information This commit makes Lead and Opportunity form view cleaner with below changes : * in Lead form view, renamed 'Tracking' group to 'Marketing' * in Opportunity form view, renamed 'Misc' group to 'Tracking' and moved 'Referred By' field to 'Marketing' group Purpose is to better highlight important marketing information and better label sections. Task-2269743 Part-of: odoo/odoo#60605 --- addons/crm/views/crm_lead_views.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml index d6d7a185773..f4893417b60 100644 --- a/addons/crm/views/crm_lead_views.xml +++ b/addons/crm/views/crm_lead_views.xml @@ -261,7 +261,7 @@ - + @@ -312,11 +312,11 @@ - - - - + + + + From 82dd868859a99dc20cb66cbe536fd56339312f5b Mon Sep 17 00:00:00 2001 From: Nikunj Ladava Date: Tue, 28 Sep 2021 14:40:47 +0000 Subject: [PATCH 2/6] [FIX] crm_iap_enrich: also enrich leads without PLS probability Current domain to enrich leads exclude those whose probability is 100 (aka won leads) with a leaf ('probability', '<', 100) . However this also excludes leads with probability being NULL, meaning we have to update the domain to be sure to include all not-won leads. Task-2269743 Part-of: odoo/odoo#60605 --- addons/crm_iap_enrich/models/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm_iap_enrich/models/crm_lead.py b/addons/crm_iap_enrich/models/crm_lead.py index bd10c879143..401c5426fea 100644 --- a/addons/crm_iap_enrich/models/crm_lead.py +++ b/addons/crm_iap_enrich/models/crm_lead.py @@ -36,7 +36,7 @@ class Lead(models.Model): leads = self.search([ ('iap_enrich_done', '=', False), ('reveal_id', '=', False), - ('probability', '<', 100), + '|', ('probability', '<', 100), ('probability', '=', False), ('create_date', '>', timeDelta) ]) leads.iap_enrich(from_cron=True) From 03690200991010cf3dcf0c4b7f7803364a25234f Mon Sep 17 00:00:00 2001 From: Nikunj Ladava Date: Tue, 28 Sep 2021 14:45:59 +0000 Subject: [PATCH 3/6] [FIX] crm_iap_enrich: skip leads without email No need to log a message telling there is an issue with lead email when email is void. Simply skip its enrich. Task-2269743 Part-of: odoo/odoo#60605 --- addons/crm_iap_enrich/models/crm_lead.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/crm_iap_enrich/models/crm_lead.py b/addons/crm_iap_enrich/models/crm_lead.py index 401c5426fea..28a3d307a18 100644 --- a/addons/crm_iap_enrich/models/crm_lead.py +++ b/addons/crm_iap_enrich/models/crm_lead.py @@ -55,6 +55,9 @@ class Lead(models.Model): # If lead is lost, active == False, but is anyway removed from the search in the cron. if lead.probability == 100 or lead.iap_enrich_done: continue + # Skip if no email (different from wrong email leading to no email_normalized) + if not lead.email_from: + continue normalized_email = tools.email_normalize(lead.email_from) if not normalized_email: From 5277316729de58f3c305a341adac14288b4fd6a0 Mon Sep 17 00:00:00 2001 From: Nikunj Ladava Date: Tue, 10 Aug 2021 10:13:06 +0000 Subject: [PATCH 4/6] [IMP] {crm}_iap_enrich: enrich leads on creation for auto mode Right now, when we choose to automatically enrich the leads from CRM settings, it activates a cron to periodically enrich the leads using IAP service. This commit improves the behavior by enriching the leads after the records creation using cron trigger. That way it is done nearly after creation and user gets enrich information sooner. To make it clear to users, the description for 'auto' mode is improved to 'Enrich all leads on creation'. Also, now we select 'auto' mode by default instead of 'manual', and display 'Enrich' button on form view irrespective of the selected mode (if lead meets certain conditions) unlike before. Rest of the behavior is still same as before. For example, we still have server action which can enrich the selected leads in batch, which is useful if there are existing leads before we enable 'Lead Enrichment' feature. Task-2269743 Part-of: odoo/odoo#60605 --- addons/crm/models/res_config_settings.py | 2 +- addons/crm/views/res_config_settings_views.xml | 2 +- addons/crm_iap_enrich/__init__.py | 4 ++-- addons/crm_iap_enrich/models/crm_lead.py | 15 +++++++++++---- addons/iap/tests/common.py | 1 + 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/addons/crm/models/res_config_settings.py b/addons/crm/models/res_config_settings.py index 587d49aa38c..ff9e1cc4bec 100644 --- a/addons/crm/models/res_config_settings.py +++ b/addons/crm/models/res_config_settings.py @@ -42,7 +42,7 @@ class ResConfigSettings(models.TransientModel): lead_enrich_auto = fields.Selection([ ('manual', 'Enrich leads on demand only'), ('auto', 'Enrich all leads automatically'), - ], string='Enrich lead automatically', default='manual', config_parameter='crm.iap.lead.enrich.setting') + ], string='Enrich lead automatically', default='auto', config_parameter='crm.iap.lead.enrich.setting') lead_mining_in_pipeline = fields.Boolean("Create a lead mining request directly from the opportunity pipeline.", config_parameter='crm.lead_mining_in_pipeline') predictive_lead_scoring_start_date = fields.Date(string='Lead Scoring Starting Date', compute="_compute_pls_start_date", inverse="_inverse_pls_start_date_str") predictive_lead_scoring_start_date_str = fields.Char(string='Lead Scoring Starting Date in String', config_parameter='crm.pls_start_date') diff --git a/addons/crm/views/res_config_settings_views.xml b/addons/crm/views/res_config_settings_views.xml index fc3407b4006..0bc6794e609 100644 --- a/addons/crm/views/res_config_settings_views.xml +++ b/addons/crm/views/res_config_settings_views.xml @@ -127,7 +127,7 @@