Merge pull request #1039 from frappe/mergify/bp/main-hotfix/pr-1038

fix: to status type is not accessible (backport #1038)
This commit is contained in:
Shariq Ansari 2025-07-15 12:57:12 +05:30 committed by GitHub
commit 92879d3cbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,6 +22,8 @@ def get_duration(from_date, to_date):
def add_status_change_log(doc):
to_status_type = frappe.db.get_value("CRM Deal Status", doc.status, "type") if doc.status else None
if not doc.is_new():
previous_status = doc.get_doc_before_save().status if doc.get_doc_before_save() else None
previous_status_type = (
@ -41,7 +43,6 @@ def add_status_change_log(doc):
"log_owner": frappe.session.user,
},
)
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 or ""