[item] [naming] by series or code / [naming series] optionally set number of digits

This commit is contained in:
Rushabh Mehta
2013-05-02 15:36:33 +05:30
parent 88f6acdbe4
commit f5f478ee78
8 changed files with 108 additions and 22 deletions

View File

@@ -31,6 +31,7 @@ keydict = {
'item_group': 'default_item_group',
'customer_group': 'default_customer_group',
'cust_master_name': 'cust_master_name',
"item_naming_by": "item_naming_by",
'supplier_type': 'default_supplier_type',
'supp_master_name': 'supp_master_name',
'territory': 'default_territory',

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-03-25 11:08:14",
"creation": "2013-04-01 15:05:24",
"docstatus": 0,
"modified": "2013-03-28 15:41:03",
"modified": "2013-05-02 15:05:21",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -27,8 +27,6 @@
"permlevel": 0
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
@@ -167,6 +165,13 @@
"read_only": 0,
"width": "50%"
},
{
"doctype": "DocField",
"fieldname": "item_naming_by",
"fieldtype": "Select",
"label": "Item Naming By",
"options": "Item Code\nNaming Series"
},
{
"doctype": "DocField",
"fieldname": "default_item_group",
@@ -502,6 +507,11 @@
"label": "SMS Sender Name",
"read_only": 0
},
{
"amend": 0,
"cancel": 0,
"doctype": "DocPerm"
},
{
"doctype": "DocPerm"
}

View File

@@ -123,7 +123,14 @@ class DocType:
def validate_series_name(self, n):
import re
if not re.match('[a-zA-Z0-9]+(([-/][a-zA-Z0-9])?[-/][a-zA-Z0-9]*)*',n):
if "." in n:
parts = n.split(".")
if len(parts) > 2:
msgprint("Only one dot (.) allowed in " + n, raise_exception=1)
if not re.match("#+$", parts[-1]):
msgprint("Numbering series must be in hashes (e.g. ####)", raise_exception=1)
n = n[0]
if not re.match("^[a-zA-Z0-9-/]*$", n):
msgprint('Special Characters except "-" and "/" not allowed in naming series')
raise Exception

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-01-10 16:34:23",
"creation": "2013-01-25 11:35:08",
"docstatus": 0,
"modified": "2013-01-22 14:56:34",
"modified": "2013-05-02 15:34:41",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -25,8 +25,6 @@
"permlevel": 0
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
@@ -62,7 +60,7 @@
"fieldname": "help_html",
"fieldtype": "HTML",
"label": "Help HTML",
"options": "<div class=\"help-box\">\nEdit list of Series in the box below. Each Series Prefix on a new line.<br><br>\nAllowed special characters are \"/\" and \"-\"<br>\nExamples:<br>\nINV-<br>\nINV-10-<br>\nINVK-<br>\n</div>"
"options": "<div class=\"well\">\nEdit list of Series in the box below. Rules:\n<ul>\n<li>Each Series Prefix on a new line.</li>\n<li>Allowed special characters are \"/\" and \"-\"</li>\n<li>Optionally, set the number of digits in the series using dot (.) followed by hashes (#). For example, \".####\" means that the series will have four digits. Default is five digits.</li>\n</ul>\nExamples:<br>\nINV-<br>\nINV-10-<br>\nINVK-<br>\nINV-.####<br>\n</div>"
},
{
"doctype": "DocField",