diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.json b/crm/fcrm/doctype/crm_deal/crm_deal.json index 6b7ce0fe..f9418651 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", @@ -406,12 +407,17 @@ "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": [], - "modified": "2025-07-02 11:07:50.192089", + "modified": "2025-07-06 15:16:37.673699", "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()