瀏覽代碼

feat: allow auto clearing notificaiton log (#18344) (#18345)

(cherry picked from commit 4020513712)

Co-authored-by: Ankush Menat <ankush@frappe.io>
version-14
mergify[bot] 2 年之前
committed by GitHub
父節點
當前提交
316abf2095
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 2 個文件被更改,包括 15 次插入0 次删除
  1. +8
    -0
      frappe/desk/doctype/notification_log/notification_log.py
  2. +7
    -0
      frappe/desk/doctype/notification_log/notification_log_list.js

+ 8
- 0
frappe/desk/doctype/notification_log/notification_log.py 查看文件

@@ -20,6 +20,14 @@ class NotificationLog(Document):
except frappe.OutgoingEmailError:
self.log_error(_("Failed to send notification email"))

@staticmethod
def clear_old_logs(days=180):
from frappe.query_builder import Interval
from frappe.query_builder.functions import Now

table = frappe.qb.DocType("Notification Log")
frappe.db.delete(table, filters=(table.modified < (Now() - Interval(days=days))))


def get_permission_query_conditions(for_user):
if not for_user:


+ 7
- 0
frappe/desk/doctype/notification_log/notification_log_list.js 查看文件

@@ -0,0 +1,7 @@
frappe.listview_settings["Notification Log"] = {
onload: function (listview) {
frappe.require("logtypes.bundle.js", () => {
frappe.utils.logtypes.show_log_retention_message(cur_list.doctype);
});
},
};

Loading…
取消
儲存