production order naming series patch
diff --git a/manufacturing/doctype/production_order/production_order.py b/manufacturing/doctype/production_order/production_order.py
index 0b9a94a..3ba368e 100644
--- a/manufacturing/doctype/production_order/production_order.py
+++ b/manufacturing/doctype/production_order/production_order.py
@@ -33,11 +33,6 @@
 		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"
diff --git a/manufacturing/doctype/production_order/production_order.txt b/manufacturing/doctype/production_order/production_order.txt
index 0de80f3..0f94d4e 100644
--- a/manufacturing/doctype/production_order/production_order.txt
+++ b/manufacturing/doctype/production_order/production_order.txt
@@ -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,12 +23,18 @@
   "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"
  }, 
  {
@@ -35,6 +42,15 @@
   "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", 
   "no_copy": 1, 
@@ -172,14 +188,6 @@
   "options": "Company"
  }, 
  {
-  "doctype": "DocField", 
-  "label": "Fiscal Year", 
-  "fieldname": "fiscal_year", 
-  "fieldtype": "Select", 
-  "reqd": 1, 
-  "options": "link:Fiscal Year"
- }, 
- {
   "read_only": 1, 
   "no_copy": 1, 
   "oldfieldtype": "Data", 
@@ -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"
  }
 ]
\ No newline at end of file
diff --git a/patches/december_2012/production_order_naming_series.py b/patches/december_2012/production_order_naming_series.py
new file mode 100644
index 0000000..df011cb
--- /dev/null
+++ b/patches/december_2012/production_order_naming_series.py
@@ -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)
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index b97e47b..86bb188 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -550,4 +550,8 @@
 		'patch_module': 'patches.december_2012',
 		'patch_file': 'stock_entry_cleanup',
 	},
+	{
+		'patch_module': 'patches.december_2012',
+		'patch_file': 'production_order_naming_series',
+	},
 ]
\ No newline at end of file