From cd117b15d4ae6be316cdfe912e48ac89187bbfb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Thu, 11 Mar 2021 14:48:44 +0000 Subject: [PATCH] [IMP] crm: improve crm.lead kanban ribbon display Since e86f892a7b277cc35fe32d365cfe50b7509a93a5 We have the possibility to display a "lost" and a "won" ribbon on the crm.lead kanban view. In this commit, we change things around a bit: - The "WON" ribbon was removed. Since it was redundant with the stage anyway and not very useful. - The "LOST" ribbon is now always displayed in the kanban view. And not only when coming from "duplicate leads". In addition, leads displayed when coming from the stat button on the res.partner form view now also shows lost leads (active_test=False). This can be helpful for the end user because he wants to know "all the deals that are in progress/lost/won with this specific contact". Task-2349526 closes odoo/odoo#67693 Signed-off-by: Thibault Delavallee (tde) --- addons/crm/models/crm_lead.py | 2 +- addons/crm/models/res_partner.py | 3 +- addons/crm/static/src/scss/crm.scss | 2 +- addons/crm/views/crm_lead_views.xml | 56 +++++------------------------ 4 files changed, 12 insertions(+), 51 deletions(-) diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index 0136ae72a1f..4ad57985c8d 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -1042,7 +1042,7 @@ class Lead(models.Model): :return dict: dictionary value for created kanban view """ self.ensure_one() - action = self.env["ir.actions.actions"]._for_xml_id("crm.crm_lead_action_duplicates") + action = self.env["ir.actions.actions"]._for_xml_id("crm.crm_lead_opportunities") action['domain'] = [('id', 'in', self.duplicate_lead_ids.ids)] action['context'] = { 'active_test': False, diff --git a/addons/crm/models/res_partner.py b/addons/crm/models/res_partner.py index daa354e03d5..45a8bb2dadc 100644 --- a/addons/crm/models/res_partner.py +++ b/addons/crm/models/res_partner.py @@ -41,7 +41,7 @@ class Partner(models.Model): all_partners = self.with_context(active_test=False).search([('id', 'child_of', self.ids)]) all_partners.read(['parent_id']) - opportunity_data = self.env['crm.lead'].read_group( + opportunity_data = self.env['crm.lead'].with_context(active_test=False).read_group( domain=[('partner_id', 'in', all_partners.ids)], fields=['partner_id'], groupby=['partner_id'] ) @@ -108,6 +108,7 @@ class Partner(models.Model): This function returns an action that displays the opportunities from partner. ''' action = self.env['ir.actions.act_window']._for_xml_id('crm.crm_lead_opportunities') + action['context'] = {'active_test': False} if self.is_company: action['domain'] = [('partner_id.commercial_partner_id.id', '=', self.id)] else: diff --git a/addons/crm/static/src/scss/crm.scss b/addons/crm/static/src/scss/crm.scss index bfb557d65f3..f3970e4ba69 100644 --- a/addons/crm/static/src/scss/crm.scss +++ b/addons/crm/static/src/scss/crm.scss @@ -21,7 +21,7 @@ } } - .oe_kanban_card[data-ribbon="true"] { + .oe_kanban_card_lost_ribbon { min-height: 105px; .o_kanban_record_title { max-width: calc(100% - 65px); diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml index ab7f2c66b74..5cbb20b75d9 100644 --- a/addons/crm/views/crm_lead_views.xml +++ b/addons/crm/views/crm_lead_views.xml @@ -504,6 +504,7 @@ + @@ -520,9 +521,14 @@ -
-