From 63542f79c7357b3e635080a68d867cab1e4064d2 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sun, 6 Jul 2025 15:24:23 +0530 Subject: [PATCH] fix: capture closed on datetime when deal marked as Won (cherry picked from commit 6450b69ae72ef2b7d57e30dacd314b27400e32ba) # Conflicts: # crm/fcrm/doctype/crm_deal/crm_deal.json --- crm/fcrm/doctype/crm_deal/crm_deal.json | 10 ++++++++++ crm/fcrm/doctype/crm_deal/crm_deal.py | 2 ++ 2 files changed, 12 insertions(+) diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.json b/crm/fcrm/doctype/crm_deal/crm_deal.json index 1f9f604f..14763bd8 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.json +++ b/crm/fcrm/doctype/crm_deal/crm_deal.json @@ -21,6 +21,7 @@ "deal_value", "column_break_kpxa", "close_date", + "closed_on", "contacts_tab", "contacts", "contact", @@ -409,12 +410,21 @@ "fieldtype": "Text", "label": "Lost Notes", "mandatory_depends_on": "eval: doc.lost_reason == \"Other\"" + }, + { + "fieldname": "closed_on", + "fieldtype": "Datetime", + "label": "Closed On" } ], "grid_page_length": 50, "index_web_pages_for_search": 1, "links": [], +<<<<<<< HEAD "modified": "2025-07-05 12:25:05.927806", +======= + "modified": "2025-07-06 15:16:37.673699", +>>>>>>> 6450b69a (fix: capture closed on datetime when deal marked as Won) "modified_by": "Administrator", "module": "FCRM", "name": "CRM Deal", diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.py b/crm/fcrm/doctype/crm_deal/crm_deal.py index 6e056ffe..b0011054 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.py +++ b/crm/fcrm/doctype/crm_deal/crm_deal.py @@ -24,6 +24,8 @@ class CRMDeal(Document): self.assign_agent(self.deal_owner) if self.has_value_changed("status"): add_status_change_log(self) + if self.status == "Won": + self.closed_on = frappe.utils.now_datetime() self.validate_forcasting_fields() self.validate_lost_reason()