production order naming series patch

This commit is contained in:
Nabin Hait 2012-12-20 16:00:27 +05:30
parent b5d23ee554
commit 2880a55a01
4 changed files with 39 additions and 27 deletions

View File

@ -33,11 +33,6 @@ class DocType:
self.doc = doc
self.doclist = doclist
def autoname(self):
self.doc.name = make_autoname('PRO/' + self.doc.fiscal_year[2:5] +
self.doc.fiscal_year[7:9] + '/.######')
def validate(self):
if self.doc.production_item :
item_detail = sql("select name from `tabItem` where name = '%s' and docstatus != 2"

View File

@ -2,12 +2,13 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-12-19 22:39:06",
"creation": "2012-12-20 14:31:18",
"modified_by": "Administrator",
"modified": "2012-12-20 13:57:10"
"modified": "2012-12-20 15:50:43"
},
{
"is_submittable": 1,
"autoname": "naming_series:",
"in_create": 0,
"doctype": "DocType",
"module": "Manufacturing",
@ -22,18 +23,33 @@
"parentfield": "fields"
},
{
"name": "__common__",
"parent": "Production Order",
"read": 1,
"cancel": 1,
"name": "__common__",
"amend": 1,
"create": 1,
"doctype": "DocPerm",
"submit": 1,
"write": 1,
"parenttype": "DocType",
"role": "Manufacturing User",
"permlevel": 0,
"parentfield": "permissions"
},
{
"name": "Production Order",
"doctype": "DocType"
},
{
"default": "PRO",
"doctype": "DocField",
"label": "Series",
"fieldname": "naming_series",
"fieldtype": "Select",
"reqd": 1,
"options": "\nPRO"
},
{
"read_only": 1,
"depends_on": "eval:!doc.__islocal",
@ -171,14 +187,6 @@
"reqd": 1,
"options": "Company"
},
{
"doctype": "DocField",
"label": "Fiscal Year",
"fieldname": "fiscal_year",
"fieldtype": "Select",
"reqd": 1,
"options": "link:Fiscal Year"
},
{
"read_only": 1,
"no_copy": 1,
@ -190,16 +198,6 @@
"fieldtype": "Data"
},
{
"amend": 1,
"create": 1,
"doctype": "DocPerm",
"submit": 1,
"write": 1,
"cancel": 1,
"permlevel": 0
},
{
"doctype": "DocPerm",
"permlevel": 1
"doctype": "DocPerm"
}
]

View File

@ -0,0 +1,15 @@
import webnotes
def execute():
from webnotes.utils import cstr
from webnotes.model.code import get_obj
fy_list = webnotes.conn.sql("""select name from `tabFiscal Year`
where docstatus < 2 order by year_start_date desc""")
series_list = []
for fy in fy_list:
series_list.append("PRO/" + cstr(fy[0][2:5]) + cstr(fy[0][7:9]) + "/")
naming_series_obj = get_obj("Naming Series")
naming_series_obj.doc.user_must_always_select = 1
naming_series_obj.set_series_for("Production Order", series_list)

View File

@ -550,4 +550,8 @@ patch_list = [
'patch_module': 'patches.december_2012',
'patch_file': 'stock_entry_cleanup',
},
{
'patch_module': 'patches.december_2012',
'patch_file': 'production_order_naming_series',
},
]