From 2375726e8eb9978ae45869084c68cd7539f28974 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 10 Jul 2024 12:03:56 +0530 Subject: [PATCH 1/2] fix: removed hardcoded values --- crm/fcrm/doctype/crm_lead/crm_lead.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crm/fcrm/doctype/crm_lead/crm_lead.py b/crm/fcrm/doctype/crm_lead/crm_lead.py index c9269e8a..ee99057d 100644 --- a/crm/fcrm/doctype/crm_lead/crm_lead.py +++ b/crm/fcrm/doctype/crm_lead/crm_lead.py @@ -339,10 +339,11 @@ def convert_to_deal(lead, doc=None): frappe.throw(_("Not allowed to convert Lead to Deal"), frappe.PermissionError) lead = frappe.get_cached_doc("CRM Lead", lead) - lead.status = "Qualified" + if frappe.db.exists("CRM Lead Status", "Qualified"): + lead.status = "Qualified" lead.converted = 1 - if lead.sla: - lead.communication_status = 'Replied' + if lead.sla and frappe.db.exists("CRM Communication Status", "Replied"): + lead.communication_status = "Replied" lead.save(ignore_permissions=True) contact = lead.create_contact(False) organization = lead.create_organization() From b9990f5b5279bb1a4d99a25eb063c4963d79398d Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 10 Jul 2024 12:24:43 +0530 Subject: [PATCH 2/2] fix: cannot capture custom data from deal modal --- crm/fcrm/doctype/crm_deal/crm_deal.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.py b/crm/fcrm/doctype/crm_deal/crm_deal.py index 4ca327ad..395619b7 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.py +++ b/crm/fcrm/doctype/crm_deal/crm_deal.py @@ -298,8 +298,11 @@ def create_deal(args): deal.update({ "organization": args.get("organization") or create_organization(args), "contacts": [{"contact": contact, "is_primary": 1}] if contact else [], - "deal_owner": args.get("deal_owner"), - "status": args.get("status"), }) + + args.pop("organization", None) + + deal.update(args) + deal.insert(ignore_permissions=True) return deal.name