Merge branch 'master' of github.com:webnotes/erpnext
Conflicts:
patches/patch.py
diff --git a/patches/patch.py b/patches/patch.py
index fa5ef49..3d5e308 100644
--- a/patches/patch.py
+++ b/patches/patch.py
@@ -1,7 +1,7 @@
# REMEMBER to update this
# ========================
-last_patch = 318
+last_patch = 319
#-------------------------------------------
@@ -1277,3 +1277,6 @@
sql("update `tabPage` set name = 'profile-settings' where page_name = 'Profile Settings'")
elif patch_no == 318:
reload_doc('utilities', 'doctype', 'bulk_rename_tool')
+ elif patch_no == 319:
+ sql("delete from tabFeed where doc_name like 'New %'")
+
diff --git a/utilities/doctype/bulk_rename_tool/__init__.py b/utilities/doctype/bulk_rename_tool/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/utilities/doctype/bulk_rename_tool/__init__.py
+++ /dev/null
diff --git a/utilities/doctype/bulk_rename_tool/bulk_rename_tool.py b/utilities/doctype/bulk_rename_tool/bulk_rename_tool.py
deleted file mode 100644
index 19cf07f..0000000
--- a/utilities/doctype/bulk_rename_tool/bulk_rename_tool.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-
-# -----------------------------------------------------------------------------------------
-
-class DocType:
- def __init__(self, d, dl):
- self.doc, self.doclist = d, dl
-
- # bulk rename
- def do_rename(self):
- import csv
- data = csv.reader(self.get_csv_data().splitlines())
-
- updated = 0
-
- msgprint(self.doc.rename_doctype)
-
- if self.doc.rename_doctype == 'Account':
- for line in data:
- if len(line)==2:
- rec = sql("select tc.abbr, ta.name from `tabAccount` ta, `tabCompany` tc where ta.company = tc.name and ta.account_name = %s", line[0], as_dict=1)
- if rec:
- new_name = line[1] + ' - ' + rec[0]['abbr']
-
- webnotes.conn.begin()
- webnotes.model.rename(self.doc.rename_doctype, rec[0]['name'], new_name)
- sql("update `tabAccount` set account_name = '%s' where name = '%s'" %(line[1],new_name))
- webnotes.conn.commit()
-
- updated += 1
- else:
- msgprint("[Ignored] Incorrect format: %s" % str(line))
- else:
- for line in data:
- if len(line)==2:
-
- webnotes.conn.begin()
-
- obj = get_obj(self.doc.rename_doctype, line[0])
- if hasattr(obj, 'on_rename'):
- obj.on_rename(line[1],line[0])
-
- webnotes.model.rename(self.doc.rename_doctype, line[0], line[1])
-
- webnotes.conn.commit()
-
- updated += 1
- else:
- msgprint("[Ignored] Incorrect format: %s" % str(line))
-
-
- msgprint("<b>%s</b> items updated" % updated)
-
- # Update CSV data
- def get_csv_data(self):
- if not self.doc.file_list:
- msgprint("File not attached!")
- raise Exception
-
- fid = self.doc.file_list.split(',')[1]
-
- from webnotes.utils import file_manager
- fn, content = file_manager.get_file(fid)
-
- if not type(content) == str:
- content = content.tostring()
-
- return content
diff --git a/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt b/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt
deleted file mode 100644
index afb7005..0000000
--- a/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt
+++ /dev/null
@@ -1,99 +0,0 @@
-# DocType, Bulk Rename Tool
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2011-07-07 16:14:45',
- 'docstatus': 0,
- 'modified': '2011-07-07 16:16:16',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all DocType
- {
- '_last_update': '1310035501',
- 'allow_attach': 1,
- 'autoname': 'field:rename_doctype',
- 'colour': 'White:FFF',
- 'doctype': 'DocType',
- 'module': 'Utilities',
- 'name': '__common__',
- 'section_style': 'Simple',
- 'show_in_menu': 0,
- 'version': 4
- },
-
- # These values are common for all DocField
- {
- 'doctype': 'DocField',
- 'name': '__common__',
- 'parent': 'Bulk Rename Tool',
- 'parentfield': 'fields',
- 'parenttype': 'DocType',
- 'permlevel': 0
- },
-
- # These values are common for all DocPerm
- {
- 'doctype': 'DocPerm',
- 'name': '__common__',
- 'parent': 'Bulk Rename Tool',
- 'parentfield': 'permissions',
- 'parenttype': 'DocType',
- 'read': 1,
- 'role': 'System Manager'
- },
-
- # DocType, Bulk Rename Tool
- {
- 'doctype': 'DocType',
- 'name': 'Bulk Rename Tool'
- },
-
- # DocPerm
- {
- 'create': 1,
- 'doctype': 'DocPerm',
- 'idx': 1,
- 'permlevel': 0,
- 'submit': 1,
- 'write': 1
- },
-
- # DocPerm
- {
- 'doctype': 'DocPerm',
- 'idx': 2,
- 'permlevel': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'rename_doctype',
- 'fieldtype': 'Data',
- 'idx': 1,
- 'label': 'Rename DocType',
- 'options': 'Suggest',
- 'reqd': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'file_list',
- 'fieldtype': 'Text',
- 'idx': 2,
- 'label': 'File List'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldtype': 'Button',
- 'idx': 3,
- 'label': 'Rename',
- 'options': 'do_rename'
- }
-]
\ No newline at end of file