From fe3046a1c581e154f63a4ecdfa2f06cee16ce5d3 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Tue, 31 Oct 2023 13:37:19 +0530 Subject: [PATCH] fix: remove validation for date filters --- frappe/core/doctype/audit_trail/audit_trail.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/frappe/core/doctype/audit_trail/audit_trail.py b/frappe/core/doctype/audit_trail/audit_trail.py index 29d8ee8eae..3270a6c56f 100644 --- a/frappe/core/doctype/audit_trail/audit_trail.py +++ b/frappe/core/doctype/audit_trail/audit_trail.py @@ -21,8 +21,8 @@ class AuditTrail(Document): doctype_name: DF.Link document: DF.DynamicLink - end_date: DF.Date - start_date: DF.Date + end_date: DF.Date | None + start_date: DF.Date | None # end: auto-generated types pass @@ -33,8 +33,6 @@ class AuditTrail(Document): fields_dict = { "DocType": self.doctype_name, "Document": self.document, - "Start Date": self.start_date, - "End Date": self.end_date, } for field in fields_dict: if not fields_dict[field]: @@ -63,13 +61,14 @@ class AuditTrail(Document): } def get_amended_documents(self): + start_date = self.get("start_date") amended_document_names = [] curr_doc = self.document creation = frappe.db.get_value(self.doctype_name, self.document, "creation") while ( curr_doc and len(amended_document_names) < 5 - and compare(creation, ">=", self.start_date, "Date") + and (start_date is None or compare(creation, ">=", start_date, "Date")) ): amended_document_names.append(curr_doc) curr_doc = frappe.db.get_value(self.doctype_name, curr_doc, "amended_from")