code review: use delete from to delete records
This commit is contained in:
parent
5988da9a31
commit
20721942ad
@ -3,10 +3,4 @@ import frappe
|
|||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
subscriptions = frappe.db.sql('SELECT name from `tabSubscription`', as_dict=True)
|
frappe.db.sql('DELETE from `tabSubscription`')
|
||||||
|
|
||||||
for subscription in subscriptions:
|
|
||||||
doc = frappe.get_doc('Subscription', subscription['name'])
|
|
||||||
if doc.docstatus == 1:
|
|
||||||
doc.cancel()
|
|
||||||
frappe.delete_doc('Subscription', subscription['name'], force=True, ignore_permissions=True)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user