mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
code review: use delete from to delete records
This commit is contained in:
@@ -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)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user