-webnotes +frappe :boom:
diff --git a/erpnext/utilities/cleanup_data.py b/erpnext/utilities/cleanup_data.py
index 630a54e..9b1988e 100644
--- a/erpnext/utilities/cleanup_data.py
+++ b/erpnext/utilities/cleanup_data.py
@@ -16,7 +16,7 @@
sys.path.append(".")
sys.path.append("erpnext")
-import webnotes
+import frappe
#--------------------------------
@@ -34,9 +34,9 @@
"Job Applicant", "Web Page", "Website Slideshow", "Blog Post", "Blog Category", "Blogger",
"Time Log", "Time Log Batch", "Workflow"]
for d in trans:
- for t in webnotes.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d):
- webnotes.conn.sql("delete from `tab%s`" % (t))
- webnotes.conn.sql("delete from `tab%s`" % (d))
+ for t in frappe.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d):
+ frappe.conn.sql("delete from `tab%s`" % (t))
+ frappe.conn.sql("delete from `tab%s`" % (d))
print "Deleted " + d
@@ -95,18 +95,18 @@
'BOM': ''
}
for d in masters.keys():
- for t in webnotes.conn.sql("select options from tabDocField where parent='%s' \
+ for t in frappe.conn.sql("select options from tabDocField where parent='%s' \
and fieldtype='Table'" % d):
- webnotes.conn.sql("delete from `tab%s`" % (t))
+ frappe.conn.sql("delete from `tab%s`" % (t))
lst = '"'+'","'.join(masters[d])+ '"'
- webnotes.conn.sql("delete from `tab%s` where name not in (%s)" % (d, lst))
+ frappe.conn.sql("delete from `tab%s` where name not in (%s)" % (d, lst))
print "Deleted " + d
def reset_all_series():
# Reset master series
- webnotes.conn.sql("""update tabSeries set current = 0 where name not in
+ frappe.conn.sql("""update tabSeries set current = 0 where name not in
('Ann/', 'BSD', 'DEF', 'DF', 'EV', 'Event Updates/', 'FileData-',
'FL', 'FMD/', 'GLM Detail', 'Login Page/', 'MDI', 'MDR', 'MI', 'MIR',
'PERM', 'PR', 'SRCH/C/', 'TD', 'TIC/', 'TMD/', 'TW', 'UR', '_FEED',
@@ -115,7 +115,7 @@
print "Series updated"
def reset_transaction_series():
- webnotes.conn.sql("""update tabSeries set current = 0 where name in
+ frappe.conn.sql("""update tabSeries set current = 0 where name in
('JV', 'INV', 'BILL', 'SO', 'DN', 'PO', 'LEAD', 'ENQUIRY', 'ENQ', 'CI',
'IN', 'PS', 'IDT', 'QAI', 'QTN', 'STE', 'SQTN', 'SUP', 'SR',
'POS', 'LAP', 'LAL', 'EXP')""")
@@ -125,9 +125,9 @@
def delete_main_masters():
main_masters = ['Fiscal Year', 'Company', 'DefaultValue']
for d in main_masters:
- for t in webnotes.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d):
- webnotes.conn.sql("delete from `tab%s`" % (t))
- webnotes.conn.sql("delete from `tab%s`" % (d))
+ for t in frappe.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d):
+ frappe.conn.sql("delete from `tab%s`" % (t))
+ frappe.conn.sql("delete from `tab%s`" % (d))
print "Deleted " + d
def reset_global_defaults():
@@ -152,18 +152,18 @@
'default_price_list_currency': None,
}
- from webnotes.model.code import get_obj
+ from frappe.model.code import get_obj
gd = get_obj('Global Defaults', 'Global Defaults')
for d in flds:
gd.doc.fields[d] = flds[d]
gd.doc.save()
- webnotes.clear_cache()
+ frappe.clear_cache()
def run():
- webnotes.connect()
- webnotes.conn.begin()
+ frappe.connect()
+ frappe.conn.begin()
# Confirmation from user
confirm = ''
@@ -195,8 +195,8 @@
reset_global_defaults()
print "System cleaned up succesfully"
- webnotes.conn.commit()
- webnotes.conn.close()
+ frappe.conn.commit()
+ frappe.conn.close()
if __name__ == '__main__':