feat: allow auto clearing notificaiton log (#18344)
This commit is contained in:
parent
121a6e1108
commit
4020513712
2 changed files with 15 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Reference in a new issue