From 4b51801f75e192af0b57808dc0d94b3ec303cae3 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 30 Dec 2024 22:39:44 +0530 Subject: [PATCH] fix: db set instead of lead.save --- crm/fcrm/doctype/crm_deal/crm_deal.py | 2 +- crm/fcrm/doctype/crm_lead/crm_lead.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.py b/crm/fcrm/doctype/crm_deal/crm_deal.py index beb63cbd..b650301e 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.py +++ b/crm/fcrm/doctype/crm_deal/crm_deal.py @@ -80,7 +80,7 @@ class CRMDeal(Document): # the agent is already set as an assignee return - assign({"assign_to": [agent], "doctype": "CRM Deal", "name": self.name}) + assign({"assign_to": [agent], "doctype": "CRM Deal", "name": self.name}, ignore_permissions=True) def share_with_agent(self, agent): if not agent: diff --git a/crm/fcrm/doctype/crm_lead/crm_lead.py b/crm/fcrm/doctype/crm_lead/crm_lead.py index e81cc566..bdf0885f 100644 --- a/crm/fcrm/doctype/crm_lead/crm_lead.py +++ b/crm/fcrm/doctype/crm_lead/crm_lead.py @@ -388,11 +388,10 @@ def convert_to_deal(lead, doc=None): lead = frappe.get_cached_doc("CRM Lead", lead) if frappe.db.exists("CRM Lead Status", "Qualified"): - lead.status = "Qualified" - lead.converted = 1 + lead.db_set("status", "Qualified") + lead.db_set("converted", 1) if lead.sla and frappe.db.exists("CRM Communication Status", "Replied"): - lead.communication_status = "Replied" - lead.save(ignore_permissions=True) + lead.db_set("communication_status", "Replied") contact = lead.create_contact(False) organization = lead.create_organization() deal = lead.create_deal(contact, organization)