added rename tool
This commit is contained in:
parent
a18bef59ae
commit
64b6c2c80d
@ -1,6 +1,6 @@
|
||||
# REMEMBER to update this
|
||||
# ========================
|
||||
last_patch = 290
|
||||
last_patch = 291
|
||||
|
||||
#-------------------------------------------
|
||||
|
||||
@ -1159,4 +1159,7 @@ def execute(patch_no):
|
||||
md = Document('Module Def')
|
||||
md.module_name = 'Home'
|
||||
md.module_label = 'Home'
|
||||
md.save(1)
|
||||
md.save(1)
|
||||
elif patch_no == 291:
|
||||
relaod_doc('tools','doctype','rename_tool')
|
||||
|
@ -182,6 +182,7 @@ SetupData = function(cnty){
|
||||
['Currency',1,'Currency','','Manage list of currencies'],
|
||||
['Country',1,'Country','','Country master'],
|
||||
['State',1,'State','','State master'],
|
||||
['Rename Tool',3,'Rename Tool','','Rename a record'],
|
||||
['Activty Type',1,'Activity Type','','Types of activities that you can select in your Timesheet'],
|
||||
['City',1,'City','','City master']]};
|
||||
|
||||
|
0
tools/doctype/rename_tool/__init__.py
Executable file
0
tools/doctype/rename_tool/__init__.py
Executable file
BIN
tools/doctype/rename_tool/__init__.pyc
Executable file
BIN
tools/doctype/rename_tool/__init__.pyc
Executable file
Binary file not shown.
5
tools/doctype/rename_tool/rename_tool.js
Normal file
5
tools/doctype/rename_tool/rename_tool.js
Normal file
@ -0,0 +1,5 @@
|
||||
// over-ride the link query to return relevant link names
|
||||
|
||||
cur_frm.fields_dict.document_to_rename.get_query = function(doc, dt, dn) {
|
||||
return "SELECT name FROM `tab"+doc.select_doctype+"` WHERE docstatus<2 AND name LIKE '%s' LIMIT 50";
|
||||
}
|
20
tools/doctype/rename_tool/rename_tool.py
Normal file
20
tools/doctype/rename_tool/rename_tool.py
Normal file
@ -0,0 +1,20 @@
|
||||
class DocType:
|
||||
def __init__(self, d, dl=[]):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def rename(self):
|
||||
"""
|
||||
Generate update quereies for rename
|
||||
"""
|
||||
import webnotes.model
|
||||
from webnotes.model.code import get_obj
|
||||
|
||||
# call on_rename method if exists
|
||||
obj = get_obj(self.doc.select_doctype, self.doc.document_to_rename)
|
||||
if hasattr(obj, 'on_rename'):
|
||||
obj.on_rename(self.doc.new_name)
|
||||
|
||||
# rename the document
|
||||
webnotes.model.rename(self.doc.select_doctype, self.doc.document_to_rename, self.doc.new_name)
|
||||
|
||||
webnotes.msgprint("Item renamed successfully")
|
BIN
tools/doctype/rename_tool/rename_tool.pyc
Normal file
BIN
tools/doctype/rename_tool/rename_tool.pyc
Normal file
Binary file not shown.
225
tools/doctype/rename_tool/rename_tool.txt
Executable file
225
tools/doctype/rename_tool/rename_tool.txt
Executable file
@ -0,0 +1,225 @@
|
||||
[
|
||||
{
|
||||
'_last_update': '1308739509',
|
||||
'allow_attach': None,
|
||||
'allow_copy': None,
|
||||
'allow_email': 1,
|
||||
'allow_print': 1,
|
||||
'allow_rename': None,
|
||||
'allow_trash': None,
|
||||
'autoname': None,
|
||||
'change_log': None,
|
||||
'client_script': None,
|
||||
'client_script_core': None,
|
||||
'client_string': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-06-22 16:08:49',
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocType',
|
||||
'document_type': None,
|
||||
'dt_template': None,
|
||||
'hide_heading': 0,
|
||||
'hide_toolbar': 0,
|
||||
'idx': None,
|
||||
'in_create': None,
|
||||
'in_dialog': None,
|
||||
'is_transaction_doc': None,
|
||||
'issingle': 1,
|
||||
'istable': None,
|
||||
'max_attachments': None,
|
||||
'menu_index': None,
|
||||
'modified': '2011-06-22 16:24:18',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Tools',
|
||||
'name': 'Rename Tool',
|
||||
'name_case': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parent_node': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'print_outline': None,
|
||||
'read_only': None,
|
||||
'read_only_onload': None,
|
||||
'search_fields': None,
|
||||
'section_style': 'Simple',
|
||||
'server_code': None,
|
||||
'server_code_compiled': None,
|
||||
'server_code_core': None,
|
||||
'server_code_error': None,
|
||||
'show_in_menu': 0,
|
||||
'smallicon': None,
|
||||
'subject': None,
|
||||
'tag_fields': None,
|
||||
'use_template': None,
|
||||
'version': 6
|
||||
},
|
||||
{
|
||||
'amend': None,
|
||||
'cancel': None,
|
||||
'create': 1,
|
||||
'creation': '2011-06-22 16:08:49',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'execute': None,
|
||||
'idx': 1,
|
||||
'match': None,
|
||||
'modified': '2011-06-22 16:24:18',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00829',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Rename Tool',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'System Manager',
|
||||
'submit': None,
|
||||
'write': 1
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-06-22 16:08:49',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'select_doctype',
|
||||
'fieldtype': 'Select',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'in_filter': None,
|
||||
'label': 'Select DocType',
|
||||
'modified': '2011-06-22 16:24:18',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05282',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'link:DocType',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Rename Tool',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-06-22 16:08:49',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'document_to_rename',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'in_filter': None,
|
||||
'label': 'Document to rename',
|
||||
'modified': '2011-06-22 16:24:18',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05283',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Rename Tool',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-06-22 16:08:49',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'new_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'in_filter': None,
|
||||
'label': 'New Name',
|
||||
'modified': '2011-06-22 16:24:18',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05284',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': None,
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Rename Tool',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-06-22 16:08:49',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': None,
|
||||
'fieldtype': 'Button',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'in_filter': None,
|
||||
'label': 'Rename',
|
||||
'modified': '2011-06-22 16:24:18',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05285',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
'oldfieldtype': None,
|
||||
'options': 'rename',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Rename Tool',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': None,
|
||||
'search_index': None,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user