[todo] naming as hash
This commit is contained in:
parent
54f016606e
commit
4c8558665d
3 changed files with 6 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"allow_copy": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "TDI.########",
|
||||
"autoname": "hash",
|
||||
"creation": "2012-07-03 13:30:35",
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
|
|
@ -170,7 +170,7 @@
|
|||
"in_dialog": 0,
|
||||
"issingle": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-01-22 17:54:50.026008",
|
||||
"modified": "2015-02-02 06:38:35.187657",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "ToDo",
|
||||
|
|
|
|||
|
|
@ -197,6 +197,9 @@ class BaseDocument(object):
|
|||
), d.values())
|
||||
except Exception, e:
|
||||
if e.args[0]==1062:
|
||||
if self.meta.autoname=="hash":
|
||||
self.db_insert()
|
||||
return
|
||||
type, value, traceback = sys.exc_info()
|
||||
frappe.msgprint(_("Duplicate name {0} {1}").format(self.doctype, self.name))
|
||||
raise frappe.NameError, (self.doctype, self.name, e), traceback
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ def make_autoname(key, doctype=''):
|
|||
DE/09/01/0001 where 09 is the year, 01 is the month and 0001 is the series
|
||||
"""
|
||||
if key=="hash":
|
||||
return frappe.generate_hash(doctype)
|
||||
return frappe.generate_hash(doctype)[:7]
|
||||
|
||||
if not "#" in key:
|
||||
key = key + ".#####"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue