fixes to rename_tool, added serial no for rename

This commit is contained in:
Rushabh Mehta
2012-11-16 14:25:03 +05:30
parent 188185f3a3
commit ce4ed265d2
5 changed files with 45 additions and 33 deletions

View File

@@ -25,11 +25,6 @@ class DocType:
"""
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,self.doc.document_to_rename)
# rename the document
webnotes.model.rename(self.doc.select_doctype, self.doc.document_to_rename, self.doc.new_name)

View File

@@ -3,11 +3,11 @@
# These values are common in all dictionaries
{
'creation': '2012-05-03 18:43:31',
'docstatus': 0,
'modified': '2012-05-25 11:58:44',
'modified_by': u'Administrator',
'owner': u'Administrator'
u'creation': '2012-07-03 13:30:42',
u'docstatus': 0,
u'modified': '2012-11-16 14:16:09',
u'modified_by': u'Administrator',
u'owner': u'Administrator'
},
# These values are common for all DocType
@@ -16,12 +16,12 @@
'allow_email': 1,
'allow_print': 1,
'colour': u'White:FFF',
'doctype': 'DocType',
u'doctype': u'DocType',
'hide_heading': 0,
'hide_toolbar': 0,
'issingle': 1,
'module': u'Utilities',
'name': '__common__',
u'name': u'__common__',
'section_style': u'Simple',
'show_in_menu': 0,
'version': 1
@@ -29,8 +29,8 @@
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
u'doctype': u'DocField',
u'name': u'__common__',
'parent': u'Rename Tool',
'parentfield': u'fields',
'parenttype': u'DocType',
@@ -40,8 +40,8 @@
# These values are common for all DocPerm
{
'create': 1,
'doctype': u'DocPerm',
'name': '__common__',
u'doctype': u'DocPerm',
u'name': u'__common__',
'parent': u'Rename Tool',
'parentfield': u'permissions',
'parenttype': u'DocType',
@@ -53,35 +53,31 @@
# DocType, Rename Tool
{
'doctype': 'DocType',
'name': u'Rename Tool'
},
# DocPerm
{
'doctype': u'DocPerm'
u'doctype': u'DocType',
u'name': u'Rename Tool'
},
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'select_doctype',
'fieldtype': u'Select',
'label': u'Select DocType',
'options': u'\nAccount\nCompany\nCustomer\nSupplier\nEmployee\nWarehouse\nItem\nProfile'
'options': u'\nAccount\nCompany\nCustomer\nSupplier\nEmployee\nWarehouse\nItem\nProfile\nSerial No'
},
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'document_to_rename',
'fieldtype': u'Link',
'label': u'Document to rename'
'label': u'Document to rename',
'options': u'[Select]'
},
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'new_name',
'fieldtype': u'Data',
'label': u'New Name'
@@ -89,10 +85,15 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'rename',
'fieldtype': u'Button',
'label': u'Rename',
'options': u'rename'
},
# DocPerm
{
u'doctype': u'DocPerm'
}
]