From 629666c48914f9bb2e330caad2c0d4bd43200ba6 Mon Sep 17 00:00:00 2001 From: Renaud Thiry Date: Wed, 7 Jun 2023 07:02:08 +0000 Subject: [PATCH] [IMP] crm: remove loss reason toggle To set the lost reason you currently need to toggle a field in the wizard if you are marking a lead as lost. As the loss reason isn't technically necessary, we can just let users choose whether to input anything or not without having to click anything We also introduce groups so field strings are displayed. As the first field cannot easily be implied to be the loss reason anymore. task-3356095 X-original-commit: b5181ea609f798e09e2032fe182e01fd07d1c10e Part-of: odoo/odoo#124437 --- addons/crm/wizard/crm_lead_lost.py | 9 ++------- addons/crm/wizard/crm_lead_lost_views.xml | 6 ++---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/addons/crm/wizard/crm_lead_lost.py b/addons/crm/wizard/crm_lead_lost.py index 2d6402dfd1c..73cda98a8f3 100644 --- a/addons/crm/wizard/crm_lead_lost.py +++ b/addons/crm/wizard/crm_lead_lost.py @@ -10,19 +10,14 @@ class CrmLeadLost(models.TransientModel): _name = 'crm.lead.lost' _description = 'Get Lost Reason' - set_reason = fields.Boolean(string='Set a Loss Reason', compute='_compute_set_reason', - readonly=False, store=True) + set_reason = fields.Boolean(string='Set a Loss Reason', default=True, + readonly=True, store=True) lead_ids = fields.Many2many('crm.lead', string='Leads') lost_reason_id = fields.Many2one('crm.lost.reason', 'Lost Reason') lost_feedback = fields.Html( 'Closing Note', sanitize=True ) - @api.depends('lead_ids') - def _compute_set_reason(self): - for wizard in self: - wizard.set_reason = bool(wizard.lead_ids.filtered(lambda lead: lead.type == 'opportunity')) - def action_lost_reason_apply(self): """Mark lead as lost and apply the loss reason""" self.ensure_one() diff --git a/addons/crm/wizard/crm_lead_lost_views.xml b/addons/crm/wizard/crm_lead_lost_views.xml index f16c3a5b2ed..a057117a95e 100644 --- a/addons/crm/wizard/crm_lead_lost_views.xml +++ b/addons/crm/wizard/crm_lead_lost_views.xml @@ -6,12 +6,10 @@
- - - + + -