fix: set close date to now if status is Won

This commit is contained in:
Shariq Ansari 2025-06-13 14:20:50 +05:30
parent 2e27c0459c
commit a98b0e3a00

View File

@ -24,6 +24,7 @@ class CRMDeal(Document):
self.assign_agent(self.deal_owner)
if self.has_value_changed("status"):
add_status_change_log(self)
self.update_close_date()
def after_insert(self):
if self.deal_owner:
@ -133,6 +134,13 @@ class CRMDeal(Document):
if sla:
sla.apply(self)
def update_close_date(self):
"""
Update the close date based on the "Won" status.
"""
if self.status == "Won" and not self.close_date:
self.close_date = frappe.utils.nowdate()
@staticmethod
def default_list_data():
columns = [