Merge pull request #23866 from ankush/deleted_doc
fix: Allow periodically clearing deleted documents
This commit is contained in:
commit
fdcd8ab0c6
1 changed files with 8 additions and 0 deletions
|
|
@ -27,6 +27,14 @@ class DeletedDocument(Document):
|
|||
# end: auto-generated types
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def clear_old_logs(days=180):
|
||||
from frappe.query_builder import Interval
|
||||
from frappe.query_builder.functions import Now
|
||||
|
||||
table = frappe.qb.DocType("Deleted Document")
|
||||
frappe.db.delete(table, filters=(table.modified < (Now() - Interval(days=days))))
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def restore(name, alert=True):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue