cleanup for stock entry - remove production order from locals
diff --git a/public/js/utils.js b/public/js/utils.js
index 7e1a8eb..3eaad08 100644
--- a/public/js/utils.js
+++ b/public/js/utils.js
@@ -41,13 +41,6 @@
 	
 	refresh: function() {
 		erpnext.hide_naming_series();
-		
-		if(this.frm.doc.__islocal && this.frm.fields_dict.naming_series 
-				&& !this.frm.doc.naming_series) {
-			var series_opts = $.map((this.frm.fields_dict.naming_series.df.options ||
-				"").split("\n"), function(v) { return v ? v : null; });
-			if (series_opts.length==1) this.frm.set_value("naming_series", series_opts[0]);
-		}
 	}
 });
 
diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js
index d1a0da8..e4362f8 100644
--- a/stock/doctype/stock_entry/stock_entry.js
+++ b/stock/doctype/stock_entry/stock_entry.js
@@ -34,6 +34,21 @@
 			this.show_stock_ledger)
 	},
 	
+	on_submit: function() {
+		this.clean_up();
+	},
+	
+	after_cancel: function() {
+		this.clean_up();
+	},
+	
+	clean_up: function() {
+		// Clear Production Order record from locals, because it is updated via Stock Entry
+		if(this.frm.doc.production_order && this.frm.doc.purpose == "Manufacture/Repack") {
+			wn.model.clear_doclist("Production Order", this.frm.doc.production_order);
+		}
+	},
+	
 	get_items: function() {
 		this.frm.call({
 			doc: this.frm.doc,
@@ -62,6 +77,7 @@
 	toggle_enable_bom: function() {
 		this.frm.toggle_enable("bom_no", !this.frm.doc.production_order);
 	},
+
 });
 
 cur_frm.cscript = new erpnext.stock.StockEntry({frm: cur_frm});