fix: to status type is not accessible

(cherry picked from commit 38a2fa87c32742bef1c8ee2bf3b1e662751a8475)
This commit is contained in:
Shariq Ansari 2025-07-15 12:17:00 +05:30 committed by Mergify
parent bd27266b69
commit 64f4ed62ce

View File

@ -33,7 +33,7 @@ def add_status_change_log(doc):
"status_change_log",
{
"from": previous_status,
"from_type": previous_status_type,
"from_type": previous_status_type or "",
"to": "",
"to_type": "",
"from_date": now_minus_one_minute,
@ -41,10 +41,10 @@ def add_status_change_log(doc):
"log_owner": frappe.session.user,
},
)
to_status_type = frappe.db.get_value("CRM Deal Status", doc.status, "type")
to_status_type = frappe.db.get_value("CRM Deal Status", doc.status, "type") if doc.status else None
last_status_change = doc.status_change_log[-1]
last_status_change.to = doc.status
last_status_change.to_type = to_status_type
last_status_change.to_type = to_status_type or ""
last_status_change.to_date = datetime.now()
last_status_change.log_owner = frappe.session.user
last_status_change.duration = get_duration(last_status_change.from_date, last_status_change.to_date)
@ -53,7 +53,7 @@ def add_status_change_log(doc):
"status_change_log",
{
"from": doc.status,
"from_type": to_status_type,
"from_type": to_status_type or "",
"to": "",
"to_type": "",
"from_date": datetime.now(),