From 274295c415586a7c9d6a426cde076d8de62e923d Mon Sep 17 00:00:00 2001 From: asu1609 Date: Tue, 25 Jul 2023 13:09:12 +0530 Subject: [PATCH 1/4] feat: Audit-trail-report --- india_compliance/audit_trail/utils.py | 1 + india_compliance/vat_india/report/__init__.py | 0 .../vat_india/report/audit_trail/__init__.py | 0 .../report/audit_trail/audit_trail.js | 62 +++ .../report/audit_trail/audit_trail.json | 29 ++ .../report/audit_trail/audit_trail.py | 366 ++++++++++++++++++ 6 files changed, 458 insertions(+) create mode 100644 india_compliance/vat_india/report/__init__.py create mode 100644 india_compliance/vat_india/report/audit_trail/__init__.py create mode 100644 india_compliance/vat_india/report/audit_trail/audit_trail.js create mode 100644 india_compliance/vat_india/report/audit_trail/audit_trail.json create mode 100644 india_compliance/vat_india/report/audit_trail/audit_trail.py diff --git a/india_compliance/audit_trail/utils.py b/india_compliance/audit_trail/utils.py index cd3df0be3..6c382bca3 100644 --- a/india_compliance/audit_trail/utils.py +++ b/india_compliance/audit_trail/utils.py @@ -6,6 +6,7 @@ def is_audit_trail_enabled(): return bool(frappe.db.get_single_value("Accounts Settings", "enable_audit_trail")) +@frappe.whitelist() def get_audit_trail_doctypes(): return set(frappe.get_hooks("audit_trail_doctypes")) diff --git a/india_compliance/vat_india/report/__init__.py b/india_compliance/vat_india/report/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/india_compliance/vat_india/report/audit_trail/__init__.py b/india_compliance/vat_india/report/audit_trail/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/india_compliance/vat_india/report/audit_trail/audit_trail.js b/india_compliance/vat_india/report/audit_trail/audit_trail.js new file mode 100644 index 000000000..7b487ee6f --- /dev/null +++ b/india_compliance/vat_india/report/audit_trail/audit_trail.js @@ -0,0 +1,62 @@ +// Copyright (c) 2023, Resilient Tech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Audit Trail"] = { + filters: [ + { + fieldname: "report", + label: __("Report"), + fieldtype: "Select", + options: "Detailed\nSummary by Doctype\nSummary by User", + reqd: 1, + }, + { + label: __("Select Day"), + fieldtype: "Select", + fieldname: "date", + default: "Today", + options: + "Today\nYesterday\nThis Week\nThis Month\nThis Quarter\nThis Year\nLast Week\nLast Month\nLast Quarter\nLast Year\nCustom", + reqd: 1, + on_change: function (report) { + var selected_value = report.get_filter_value("date"); + var date_range = report.get_filter("date_range"); + + if (selected_value === "Custom") { + date_range.df.hidden = false; + } else { + date_range.df.hidden = true; + } + date_range.refresh(); + report.refresh(); + }, + }, + { + fieldname: "date_range", + label: __("Select Date"), + fieldtype: "DateRange", + hidden: true, + }, + { + fieldname: "user", + label: __("User"), + fieldtype: "Link", + default: "", + options: "User", + //reqd: 1 + }, + { + fieldname: "doctype", + label: __("Based On"), + fieldtype: "Autocomplete", + default: "", + get_query: function () { + return { + query: "india_compliance.audit_trail.utils.get_audit_trail_doctypes", + filters: {}, + }; + }, + }, + ], +}; diff --git a/india_compliance/vat_india/report/audit_trail/audit_trail.json b/india_compliance/vat_india/report/audit_trail/audit_trail.json new file mode 100644 index 000000000..849e8df7e --- /dev/null +++ b/india_compliance/vat_india/report/audit_trail/audit_trail.json @@ -0,0 +1,29 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2023-07-14 18:21:29.788627", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letterhead": null, + "modified": "2023-07-14 18:21:43.133641", + "modified_by": "Administrator", + "module": "VAT India", + "name": "Audit Trail", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Version", + "report_name": "Audit Trail", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Administrator" + } + ] +} \ No newline at end of file diff --git a/india_compliance/vat_india/report/audit_trail/audit_trail.py b/india_compliance/vat_india/report/audit_trail/audit_trail.py new file mode 100644 index 000000000..707f39f34 --- /dev/null +++ b/india_compliance/vat_india/report/audit_trail/audit_trail.py @@ -0,0 +1,366 @@ +# Copyright (c) 2023, Resilient Tech and contributors +# For license information, please see license.txt + +import frappe +from frappe import _ +from frappe.utils.data import format_datetime, get_timespan_date_range, getdate + +from india_compliance.audit_trail.utils import get_audit_trail_doctypes + +FIELDS = { + "supplier_name_field_doctypes": [ + "Purchase Invoice", + "Purchase Receipt", + "Stock Entry", + "Subcontracting Receipt", + ], + "customer_name_field_doctypes": [ + "POS Invoice", + "Dunning", + "Sales Invoice", + "Delivery Note", + ], + "no_name_field_doctypes": [ + "Account Settings", + "Period Closing Voucher", + "Process Deferred Accounting", + "Asset", + "Asset Repair", + "Landed Cost Voucher", + ], + "grand_total_field_doctypes": [ + "Dunning", + "Purchase Invoice", + "Sales Invoice", + "Delivery Note", + "Purchase Receipt", + "POS Invoice", + ], + "total_amount_field_doctypes": [ + "Stock Entry", + "Invoice Discounting", + "Journal Entry", + ], +} + + +def execute(filters=None): + + _class = REPORT_MAP[filters.get("report")]() + filters.pop("report") + + return _class.get_columns(), _class.get_data(filters) + + +class DetailedReport: + def get_columns(self): + + columns = [ + { + "label": _("Date and Time"), + "fieldtype": "DateTime", + "fieldname": "date_time", + "width": 200, + }, + { + "label": _("Company"), + "fieldtype": "link", + "fieldname": "company", + "options": "Company", + "width": 150, + }, + { + "label": _("Doctype"), + "fieldtype": "link", + "fieldname": "doctype", + "options": "Doctype", + "width": 150, + }, + { + "label": _("Document Name"), + "fieldtype": "data", + "fieldname": "document_name", + "width": 150, + }, + { + "label": _("Creation Date"), + "fieldtype": "date", + "fieldname": "creation_date", + "width": 150, + }, + { + "label": _("Party Name/Remarks"), + "fieldtype": "data", + "fieldname": "party_name", + "width": 180, + }, + { + "label": _("Amount"), + "fieldtype": "Int", + "fieldname": "amount", + "width": 80, + }, + { + "label": _("Created By"), + "fieldtype": "data", + "fieldname": "created_by", + "width": 200, + }, + { + "label": _("Modified By"), + "fieldtype": "data", + "fieldname": "modified_by", + "width": 200, + }, + ] + + return columns + + def get_data(self, filters): + data = [] + conditions = get_conditions(filters) + print(conditions) + + if doctype := filters.get("doctype"): + doctypes = [doctype] + else: + doctypes = get_doctypes() + + for doctype in doctypes: + fields = self.get_fields(doctype) + records = frappe.db.get_all(doctype, fields=fields, filters=conditions) + data = self.get_rows(records, doctype, data) + return data + + def get_fields(self, doctype): + fields = [ + "modified as date_time", + "company", + "name as document_name", + "owner as created_by", + "modified_by as modified_by", + ] + + if doctype == "Payment Entry": + fields.extend(["party_name", "total_allocated_amount as amount"]) + + if doctype == "Subcontracting Receipt": + fields.append("total as amount") + + if doctype == "Bill of Entry": + fields.append("total_amount_payable as amount") + + if doctype in FIELDS["supplier_name_field_doctypes"]: + fields.append("supplier_name as party_name") + + if doctype in FIELDS["customer_name_field_doctypes"]: + fields.append("customer_name as party_name") + + if doctype in FIELDS["no_name_field_doctypes"]: + return fields + + if doctype in FIELDS["grand_total_field_doctypes"]: + fields.append("grand_total as amount") + + if doctype in FIELDS["total_amount_field_doctypes"]: + fields.append("total_amount as amount") + + return fields + + def get_rows(self, records, doctype, data): + + for row in records: + row["date_time"] = format_datetime(row["date_time"]) + row["doctype"] = doctype + row["creation_date"] = getdate(row["date_time"]) + + if doctype == "Bill of Entry": + row["party_name"] = "" + elif doctype in FIELDS["no_name_field_doctypes"]: + row["party_name"] = "" + row["party_amount"] = "" + + data.append(row) + + return data + + +class DoctypeReport: + def get_columns(self): + columns = [ + { + "label": _("Doctype"), + "fieldtype": "data", + "fieldname": "doctype", + "width": 150, + }, + { + "label": _("New Records"), + "fieldtype": "data", + "fieldname": "new_record", + "width": 120, + }, + { + "label": _("Modify"), + "fieldtype": "data", + "fieldname": "modify", + "width": 80, + }, + ] + + return columns + + def get_data(self, filters): + data = [] + data = get_count(filters, data, report="doctype") + return data + + def get_rows(self, new_count, modified_count, doctype, data): + new_record = modify = 0 + for n in new_count: + new_record += n["count"] + for m in modified_count: + modify += m["count"] + + if new_record != 0: + row = {"doctype": doctype, "new_record": new_record, "modify": modify} + data.append(row) + return data + + +class UserReport: + def get_columns(self): + columns = [ + { + "label": _("User Name"), + "fieldtype": "data", + "fieldname": "user_name", + "width": 200, + }, + { + "label": _("New Records"), + "fieldtype": "data", + "fieldname": "count", + "width": 120, + }, + { + "label": _("Modify"), + "fieldtype": "data", + "fieldname": "modify", + "width": 80, + }, + ] + + return columns + + def get_data(self, filters): + data = [] + data = get_count(filters, data, report="user") + + return data + + def get_rows(self, new_count, modified_count, data): + if not data: + for row in new_count: + row["modify"] = 0 + data.append(row) + else: + for row in new_count: + owner_matched = False + + for d in data: + if row["user_name"] == d["user_name"]: + d["count"] += row["count"] + owner_matched = True + break + + if not owner_matched: + row["modify"] = 0 + data.append(row) + + for m in modified_count: + for d in data: + if m["user_name"] == d["user_name"]: + d["modify"] += m["count"] + break + return data + + +REPORT_MAP = { + "Detailed": DetailedReport, + "Summary by Doctype": DoctypeReport, + "Summary by User": UserReport, +} + + +##################### Utils ############################### + + +def get_conditions(filters): + conditions = {} + conditions["modified"] = get_date(filters) + conditions["owner"] = get_user(filters) + + return conditions + + +def get_date(filters): + + if filters["date"] == "Custom": + return ["between", [filters["date_range"][0], filters["date_range"][1]]] + elif filters["date"] == "Today" or filters["date"] == "Yesterday": + date = [get_timespan_date_range(filters["date"].lower())][0] + return ("like", f"{date[0]}%") + else: + date = [get_timespan_date_range(filters["date"].lower())][0] + return ("between", [date[0], date[1]]) + + +def get_user(filters): + + if filters.get("user"): + return filters["user"] + + else: + users = frappe.db.get_all("User", fields=["name"]) + return ["in", (user.name for user in users)] + + +def get_doctypes(): + doctypes = list(get_audit_trail_doctypes()) + doctypes.remove("Accounts Settings") + return doctypes + + +def get_count(filters, data, report): + group_by = "owner" + fields = ["owner as user_name", "count(name) as count"] + if doctype := filters.get("doctype"): + doctypes = [doctype] + else: + doctypes = get_doctypes() + + filters.pop("doctype", None) + filters["creation"] = get_date(filters) + filters.pop("date") + if filters.get("user", None): + filters["owner"] = filters.pop("user") + group_by = "" + + for doctype in doctypes: + new_count = frappe.db.get_all( + doctype, filters=filters, fields=fields, group_by=group_by + ) + modified_count = frappe.db.get_all( + "Version", + filters={**filters, "ref_doctype": doctype}, + fields=fields, + group_by=group_by, + ) + + if report == "doctype": + data = DoctypeReport().get_rows(new_count, modified_count, doctype, data) + if report == "user" and (new_count and new_count[0]["user_name"]): + data = UserReport().get_rows(new_count, modified_count, data) + + return data From 2c369934d4a94bb07f7d5b345d18be2052580a47 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Tue, 25 Jul 2023 16:33:48 +0530 Subject: [PATCH 2/4] fix: refactored as per review, fix minor conditions --- .../report/audit_trail/audit_trail.js | 3 +- .../report/audit_trail/audit_trail.py | 285 +++++++++--------- 2 files changed, 145 insertions(+), 143 deletions(-) diff --git a/india_compliance/vat_india/report/audit_trail/audit_trail.js b/india_compliance/vat_india/report/audit_trail/audit_trail.js index 7b487ee6f..17eb1c626 100644 --- a/india_compliance/vat_india/report/audit_trail/audit_trail.js +++ b/india_compliance/vat_india/report/audit_trail/audit_trail.js @@ -9,12 +9,13 @@ frappe.query_reports["Audit Trail"] = { label: __("Report"), fieldtype: "Select", options: "Detailed\nSummary by Doctype\nSummary by User", + default: "Detailed", reqd: 1, }, { label: __("Select Day"), fieldtype: "Select", - fieldname: "date", + fieldname: "date_option", default: "Today", options: "Today\nYesterday\nThis Week\nThis Month\nThis Quarter\nThis Year\nLast Week\nLast Month\nLast Quarter\nLast Year\nCustom", diff --git a/india_compliance/vat_india/report/audit_trail/audit_trail.py b/india_compliance/vat_india/report/audit_trail/audit_trail.py index 707f39f34..ef8181295 100644 --- a/india_compliance/vat_india/report/audit_trail/audit_trail.py +++ b/india_compliance/vat_india/report/audit_trail/audit_trail.py @@ -45,16 +45,87 @@ def execute(filters=None): + _class = REPORT_MAP[filters.pop("report")](filters) + return _class.get_columns(), _class.get_data() - _class = REPORT_MAP[filters.get("report")]() - filters.pop("report") - return _class.get_columns(), _class.get_data(filters) +class BaseAuditTrail: + def __init__(self, filters) -> None: + self.filters = filters - -class DetailedReport: def get_columns(self): + pass + + def get_data(self): + pass + + def append_rows(self): + pass + + def get_conditions(self): + conditions = {} + conditions["modified"] = self.get_date() + conditions["owner"] = self.get_user() + + return conditions + + def get_date(self): + date_option = self.filters.pop("date_option", None) + date_range = self.filters.pop("date_range", None) + if date_option == "Custom": + return ["between", date_range] + else: + date_range = [get_timespan_date_range(date_option.lower())][0] + return ("between", date_range) + + def get_user(self): + if self.filters.get("user"): + return self.filters["user"] + + else: + users = frappe.db.get_all("User", pluck="name") + return ["in", users] + + def get_doctypes(self): + doctypes = list(self.get_audit_trail_doctypes()) + doctypes.remove("Accounts Settings") + return doctypes + + def get_audit_trail_doctypes(self): + return get_audit_trail_doctypes() + + def update_count(self): + fields = ["owner as user_name", "count(name) as count"] + self.filters["creation"] = self.get_date() + + if doctype := self.filters.pop("doctype", None): + doctypes = [doctype] + else: + doctypes = self.get_doctypes() + + if user := self.filters.pop("user", None): + self.filters["owner"] = user + + for doctype in doctypes: + new_count = frappe.db.get_all( + doctype, + filters=self.filters, + fields=fields, + group_by=self.group_by, + ) + + modified_count = frappe.db.get_all( + "Version", + filters={**self.filters, "ref_doctype": doctype}, + fields=fields, + group_by=self.group_by, + ) + + self.append_rows(new_count, modified_count, doctype) + +class DetailedReport(BaseAuditTrail): + def get_columns(self): columns = [ { "label": _("Date and Time"), @@ -116,21 +187,21 @@ def get_columns(self): return columns - def get_data(self, filters): - data = [] - conditions = get_conditions(filters) - print(conditions) + def get_data(self): + self.data = [] + conditions = self.get_conditions() - if doctype := filters.get("doctype"): + if doctype := self.filters.get("doctype"): doctypes = [doctype] else: - doctypes = get_doctypes() + doctypes = self.get_doctypes() for doctype in doctypes: fields = self.get_fields(doctype) records = frappe.db.get_all(doctype, fields=fields, filters=conditions) - data = self.get_rows(records, doctype, data) - return data + self.append_rows(records, doctype) + + return self.data def get_fields(self, doctype): fields = [ @@ -167,8 +238,7 @@ def get_fields(self, doctype): return fields - def get_rows(self, records, doctype, data): - + def append_rows(self, records, doctype): for row in records: row["date_time"] = format_datetime(row["date_time"]) row["doctype"] = doctype @@ -180,12 +250,10 @@ def get_rows(self, records, doctype, data): row["party_name"] = "" row["party_amount"] = "" - data.append(row) + self.data.append(row) - return data - -class DoctypeReport: +class DoctypeReport(BaseAuditTrail): def get_columns(self): columns = [ { @@ -197,38 +265,42 @@ def get_columns(self): { "label": _("New Records"), "fieldtype": "data", - "fieldname": "new_record", + "fieldname": "new_count", "width": 120, }, { "label": _("Modify"), "fieldtype": "data", - "fieldname": "modify", + "fieldname": "modify_count", "width": 80, }, ] return columns - def get_data(self, filters): - data = [] - data = get_count(filters, data, report="doctype") - return data + def get_data(self): + self.data = {} + self.group_by = "" + self.update_count() + + return list(self.data.values()) + + def append_rows(self, new_records, modified_records, doctype): + new_count = modify_count = 0 + for row in new_records: + new_count += row["count"] - def get_rows(self, new_count, modified_count, doctype, data): - new_record = modify = 0 - for n in new_count: - new_record += n["count"] - for m in modified_count: - modify += m["count"] + for row in modified_records: + modify_count += row["count"] - if new_record != 0: - row = {"doctype": doctype, "new_record": new_record, "modify": modify} - data.append(row) - return data + if not (new_count or modify_count): + return + row = {"doctype": doctype, "new_count": new_count, "modify_count": modify_count} + self.data.setdefault(doctype, row) -class UserReport: + +class UserReport(BaseAuditTrail): def get_columns(self): columns = [ { @@ -240,50 +312,52 @@ def get_columns(self): { "label": _("New Records"), "fieldtype": "data", - "fieldname": "count", + "fieldname": "new_count", "width": 120, }, { "label": _("Modify"), "fieldtype": "data", - "fieldname": "modify", + "fieldname": "modify_count", "width": 80, }, ] return columns - def get_data(self, filters): - data = [] - data = get_count(filters, data, report="user") - - return data - - def get_rows(self, new_count, modified_count, data): - if not data: - for row in new_count: - row["modify"] = 0 - data.append(row) - else: - for row in new_count: - owner_matched = False - - for d in data: - if row["user_name"] == d["user_name"]: - d["count"] += row["count"] - owner_matched = True - break - - if not owner_matched: - row["modify"] = 0 - data.append(row) - - for m in modified_count: - for d in data: - if m["user_name"] == d["user_name"]: - d["modify"] += m["count"] - break - return data + def get_data(self): + self.data = {} + self.group_by = "owner" + self.update_count() + + return list(self.data.values()) + + def append_rows(self, new_records, modified_records, doctype): + for row in new_records: + user_name = row["user_name"] + user_count = self.data.setdefault( + user_name, + { + "user_name": user_name, + "new_count": 0, + "modify_count": 0, + }, + ) + + user_count["new_count"] += row["count"] + + for row in modified_records: + user_name = row["user_name"] + user_count = self.data.setdefault( + user_name, + { + "user_name": user_name, + "new_count": 0, + "modify_count": 0, + }, + ) + + user_count["modify_count"] += row["count"] REPORT_MAP = { @@ -291,76 +365,3 @@ def get_rows(self, new_count, modified_count, data): "Summary by Doctype": DoctypeReport, "Summary by User": UserReport, } - - -##################### Utils ############################### - - -def get_conditions(filters): - conditions = {} - conditions["modified"] = get_date(filters) - conditions["owner"] = get_user(filters) - - return conditions - - -def get_date(filters): - - if filters["date"] == "Custom": - return ["between", [filters["date_range"][0], filters["date_range"][1]]] - elif filters["date"] == "Today" or filters["date"] == "Yesterday": - date = [get_timespan_date_range(filters["date"].lower())][0] - return ("like", f"{date[0]}%") - else: - date = [get_timespan_date_range(filters["date"].lower())][0] - return ("between", [date[0], date[1]]) - - -def get_user(filters): - - if filters.get("user"): - return filters["user"] - - else: - users = frappe.db.get_all("User", fields=["name"]) - return ["in", (user.name for user in users)] - - -def get_doctypes(): - doctypes = list(get_audit_trail_doctypes()) - doctypes.remove("Accounts Settings") - return doctypes - - -def get_count(filters, data, report): - group_by = "owner" - fields = ["owner as user_name", "count(name) as count"] - if doctype := filters.get("doctype"): - doctypes = [doctype] - else: - doctypes = get_doctypes() - - filters.pop("doctype", None) - filters["creation"] = get_date(filters) - filters.pop("date") - if filters.get("user", None): - filters["owner"] = filters.pop("user") - group_by = "" - - for doctype in doctypes: - new_count = frappe.db.get_all( - doctype, filters=filters, fields=fields, group_by=group_by - ) - modified_count = frappe.db.get_all( - "Version", - filters={**filters, "ref_doctype": doctype}, - fields=fields, - group_by=group_by, - ) - - if report == "doctype": - data = DoctypeReport().get_rows(new_count, modified_count, doctype, data) - if report == "user" and (new_count and new_count[0]["user_name"]): - data = UserReport().get_rows(new_count, modified_count, data) - - return data From b82a2a06a11b092e367d16ba365f2d0c0a46bd02 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Tue, 25 Jul 2023 16:38:12 +0530 Subject: [PATCH 3/4] fix: move report to module audit-trail --- .../{vat_india => audit_trail}/report/__init__.py | 0 .../report/audit_trail/__init__.py | 0 .../report/audit_trail/audit_trail.js | 0 .../report/audit_trail/audit_trail.json | 5 ++--- .../report/audit_trail/audit_trail.py | 0 india_compliance/modules.txt | 3 ++- 6 files changed, 4 insertions(+), 4 deletions(-) rename india_compliance/{vat_india => audit_trail}/report/__init__.py (100%) rename india_compliance/{vat_india => audit_trail}/report/audit_trail/__init__.py (100%) rename india_compliance/{vat_india => audit_trail}/report/audit_trail/audit_trail.js (100%) rename india_compliance/{vat_india => audit_trail}/report/audit_trail/audit_trail.json (84%) rename india_compliance/{vat_india => audit_trail}/report/audit_trail/audit_trail.py (100%) diff --git a/india_compliance/vat_india/report/__init__.py b/india_compliance/audit_trail/report/__init__.py similarity index 100% rename from india_compliance/vat_india/report/__init__.py rename to india_compliance/audit_trail/report/__init__.py diff --git a/india_compliance/vat_india/report/audit_trail/__init__.py b/india_compliance/audit_trail/report/audit_trail/__init__.py similarity index 100% rename from india_compliance/vat_india/report/audit_trail/__init__.py rename to india_compliance/audit_trail/report/audit_trail/__init__.py diff --git a/india_compliance/vat_india/report/audit_trail/audit_trail.js b/india_compliance/audit_trail/report/audit_trail/audit_trail.js similarity index 100% rename from india_compliance/vat_india/report/audit_trail/audit_trail.js rename to india_compliance/audit_trail/report/audit_trail/audit_trail.js diff --git a/india_compliance/vat_india/report/audit_trail/audit_trail.json b/india_compliance/audit_trail/report/audit_trail/audit_trail.json similarity index 84% rename from india_compliance/vat_india/report/audit_trail/audit_trail.json rename to india_compliance/audit_trail/report/audit_trail/audit_trail.json index 849e8df7e..7fab66f3a 100644 --- a/india_compliance/vat_india/report/audit_trail/audit_trail.json +++ b/india_compliance/audit_trail/report/audit_trail/audit_trail.json @@ -8,10 +8,9 @@ "filters": [], "idx": 0, "is_standard": "Yes", - "letterhead": null, - "modified": "2023-07-14 18:21:43.133641", + "modified": "2023-07-25 16:35:23.470355", "modified_by": "Administrator", - "module": "VAT India", + "module": "Audit Trail", "name": "Audit Trail", "owner": "Administrator", "prepared_report": 0, diff --git a/india_compliance/vat_india/report/audit_trail/audit_trail.py b/india_compliance/audit_trail/report/audit_trail/audit_trail.py similarity index 100% rename from india_compliance/vat_india/report/audit_trail/audit_trail.py rename to india_compliance/audit_trail/report/audit_trail/audit_trail.py diff --git a/india_compliance/modules.txt b/india_compliance/modules.txt index 2e4ee9838..b15a5332f 100644 --- a/india_compliance/modules.txt +++ b/india_compliance/modules.txt @@ -1,3 +1,4 @@ GST India Income Tax India -VAT India \ No newline at end of file +VAT India +Audit Trail \ No newline at end of file From e1eaa54deaf24748cc303c85beb1135f908d52e1 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Wed, 26 Jul 2023 12:47:02 +0530 Subject: [PATCH 4/4] fix: correct field value --- .../audit_trail/report/audit_trail/audit_trail.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/india_compliance/audit_trail/report/audit_trail/audit_trail.js b/india_compliance/audit_trail/report/audit_trail/audit_trail.js index 17eb1c626..8a60703a4 100644 --- a/india_compliance/audit_trail/report/audit_trail/audit_trail.js +++ b/india_compliance/audit_trail/report/audit_trail/audit_trail.js @@ -21,8 +21,8 @@ frappe.query_reports["Audit Trail"] = { "Today\nYesterday\nThis Week\nThis Month\nThis Quarter\nThis Year\nLast Week\nLast Month\nLast Quarter\nLast Year\nCustom", reqd: 1, on_change: function (report) { - var selected_value = report.get_filter_value("date"); - var date_range = report.get_filter("date_range"); + let selected_value = report.get_filter_value("date_option"); + let date_range = report.get_filter("date_range"); if (selected_value === "Custom") { date_range.df.hidden = false; @@ -45,7 +45,6 @@ frappe.query_reports["Audit Trail"] = { fieldtype: "Link", default: "", options: "User", - //reqd: 1 }, { fieldname: "doctype",