[FIX] crm: lost button don't trigger lost reason popup in list for leads

Steps to reproduce:

- Install crm
- Go to settings and activate leads in crm.
- Go to leads list and select any lead, now mark it as lost.

Issue:

It will ask for lost reason. But if we do it from the Leads form view,
we don't get to set any reason. I discussed with the PO and we don't
want to add the lost reason in the leads.

Solution:

Modified action of lost so it takes leads into account.

opw-3119748

closes odoo/odoo#120033

X-original-commit: 3834577a8beec2f9eb4a30dd8a0ae72403041af5
Signed-off-by: Maruan Aguerdouh Mohtar (magm) <magm@odoo.com>
This commit is contained in:
Maruan Aguerdouh (magm)
2023-05-03 17:24:53 +02:00
parent 39fdb8064c
commit 6a5cc4c7b4
+6 -1
View File
@@ -10,7 +10,12 @@
<field name="binding_model_id" ref="crm.model_crm_lead"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = model.action_set_lost_with_reason()</field>
<field name="code">
if not 'opportunity' in records.mapped('type'):
action = records.action_set_lost()
else:
action = model.action_set_lost_with_reason()
</field>
</record>
<record id="action_your_pipeline" model="ir.actions.server">