fix: return None if document does not have status field in get_status… (#46415)

* fix: return None if document does not have status field in get_status function

* chore: add comment
This commit is contained in:
Mihir Kandoi
2025-03-12 16:05:08 +05:30
committed by GitHub
parent 67e9389a02
commit 41c93c8832

View File

@@ -220,7 +220,9 @@ class StatusUpdater(Document):
}
"""
if self.doctype not in status_map:
return {"status": self.status}
return {
"status": self.get("status")
} # sometimes status field is not present on certain DocTypes such as Stock Entry
sl = status_map[self.doctype][:]
sl.reverse()
@@ -562,7 +564,8 @@ class StatusUpdater(Document):
target = frappe.get_doc(args["target_parent_dt"], args["name"])
target.update(update_data) # status calculus might depend on it
status = target.get_status()
update_data.update(status)
if status.get("status"):
update_data.update(status)
target.db_set(update_data, update_modified=update_modified, notify=True)
def _update_modified(self, args, update_modified):