fix: capture closed on datetime when deal marked as Won

This commit is contained in:
Shariq Ansari 2025-07-06 15:24:23 +05:30
parent 3b34f73cb3
commit 6450b69ae7
2 changed files with 9 additions and 1 deletions

View File

@ -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",

View File

@ -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()