fixes to rename_tool, added serial no for rename
diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js
index 2f52e7f..35cc2f7 100644
--- a/home/page/latest_updates/latest_updates.js
+++ b/home/page/latest_updates/latest_updates.js
@@ -4,6 +4,7 @@
the appraiser can select the template and role and make an appraisal. \
Normal user can see self created Appraisals. HR Manager can see all Appraisals.",
"Project: Bugfix in Gantt Chart (caused due to jquery conflict)",
+ "Serial No: Ability to rename.",
]],
["15th November 2012", [
"Customer Issue: Moved all allocations to 'Assigned' so that there is avoid duplication fo features.",
diff --git a/selling/doctype/lead/lead_list.js b/selling/doctype/lead/lead_list.js
index e3ff931..e700bc8 100644
--- a/selling/doctype/lead/lead_list.js
+++ b/selling/doctype/lead/lead_list.js
@@ -19,7 +19,7 @@
data.label_type = 'info'
}
data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
- data.lead_name = repl("<a href=\"#!Form/Lead/%(name)s\">%(lead_name)s</a>",
+ data.lead_name = repl("<a href=\"#!Form/Lead/%(name)s\">%(name): %(lead_name)s</a>",
data);
data.lead_status = (data.rating ? ('['+data.rating+'] ') : '') + '['+data.source+']';
},
diff --git a/stock/doctype/serial_no/serial_no.py b/stock/doctype/serial_no/serial_no.py
index 931e0fe..63b23ca 100644
--- a/stock/doctype/serial_no/serial_no.py
+++ b/stock/doctype/serial_no/serial_no.py
@@ -118,8 +118,23 @@
def on_cancel(self):
self.on_trash()
- # -----------
- # on restore
- # -----------
def on_restore(self):
self.make_stock_ledger_entry(1)
+
+ def on_rename(self, new, old):
+ """rename serial_no text fields"""
+ for dt in webnotes.conn.sql("""select parent from tabDocField
+ where fieldname='serial_no' and fieldtype='Text'"""):
+
+ for item in webnotes.conn.sql("""select name, serial_no from `tab%s`
+ where serial_no like '%%%s%%'""" % (dt[0], old)):
+
+ serial_nos = map(lambda i: i==old and new or i, item[1].split('\n'))
+ webnotes.conn.sql("""update `tab%s` set serial_no = %s
+ where name=%s""" % (dt[0], '%s', '%s'),
+ ('\n'.join(serial_nos), item[0]))
+
+
+
+
+
\ No newline at end of file
diff --git a/utilities/doctype/rename_tool/rename_tool.py b/utilities/doctype/rename_tool/rename_tool.py
index 2a2ad92..b0d7671 100644
--- a/utilities/doctype/rename_tool/rename_tool.py
+++ b/utilities/doctype/rename_tool/rename_tool.py
@@ -25,11 +25,6 @@
"""
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)
diff --git a/utilities/doctype/rename_tool/rename_tool.txt b/utilities/doctype/rename_tool/rename_tool.txt
index c9ee46f..e7a08ec 100755
--- a/utilities/doctype/rename_tool/rename_tool.txt
+++ b/utilities/doctype/rename_tool/rename_tool.txt
@@ -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'
}
]
\ No newline at end of file