Merge pull request #6536 from frappe/umairsy-patch-4

Update supplier.md
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index d598ee2..d39c80f 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -115,7 +115,7 @@
 		'''Update status of production order if unknown'''
 		if not status:
 			status = self.get_status(status)
-			
+
 		if status != self.status:
 			self.db_set("status", status)
 
@@ -240,7 +240,7 @@
 			holidays[holiday_list] = holiday_list_days
 
 		return holidays[holiday_list]
-		
+
 	def make_time_logs(self, open_new=False):
 		"""Capacity Planning. Plan time logs based on earliest availablity of workstation after
 			Planned Start Date. Time logs will be created and remain in Draft mode and must be submitted
@@ -261,7 +261,7 @@
 			if d.workstation and d.status != 'Completed':
 				last_workstation_idx[d.workstation] = i # set last row index of workstation
 				self.set_start_end_time_for_workstation(d, workstation_list, last_workstation_idx.get(d.workstation))
-				
+
 				args = self.get_operations_data(d)
 				add_timesheet_detail(timesheet, args)
 				original_start_time = d.planned_start_time
@@ -366,7 +366,8 @@
 		if frappe.db.get_value("Item", self.production_item, "has_variants"):
 			frappe.throw(_("Production Order cannot be raised against a Item Template"), ItemHasVariantError)
 
-		validate_end_of_life(self.production_item)
+		if self.production_item:
+			validate_end_of_life(self.production_item)
 
 	def validate_qty(self):
 		if not self.qty > 0:
@@ -520,7 +521,7 @@
 	timesheet.production_order = production_order
 	return timesheet
 
-@frappe.whitelist()	
+@frappe.whitelist()
 def add_timesheet_detail(timesheet, args):
 	if isinstance(timesheet, unicode):
 		timesheet = frappe.get_doc('Timesheet', timesheet)
diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css
index ab3beb0..2bfcd3e 100644
--- a/erpnext/public/css/website.css
+++ b/erpnext/public/css/website.css
@@ -2,6 +2,9 @@
   font-size: 18px;
   line-height: 200%;
 }
+.web-page-content {
+  margin-bottom: 30px;
+}
 .item-stock {
   margin-bottom: 10px !important;
 }
diff --git a/erpnext/public/js/shopping_cart.js b/erpnext/public/js/shopping_cart.js
index f5819a8..ace7fd8 100644
--- a/erpnext/public/js/shopping_cart.js
+++ b/erpnext/public/js/shopping_cart.js
@@ -10,7 +10,7 @@
 		$('.navbar li[data-label="User"] a')
 			.html('<i class="icon-fixed-width icon-user"></i> ' + full_name);
 	}
-	
+
 	// update login
 	shopping_cart.show_shoppingcart_dropdown();
 	shopping_cart.set_cart_count();
@@ -32,7 +32,7 @@
 			}
 		});
 	},
-	
+
 	update_cart: function(opts) {
 		if(!full_name || full_name==="Guest") {
 			if(localStorage) {
@@ -50,10 +50,10 @@
 				},
 				btn: opts.btn,
 				callback: function(r) {
-					shopping_cart.set_cart_count();	
+					shopping_cart.set_cart_count();
 					if (r.message.shopping_cart_menu) {
 						$('.shopping-cart-menu').html(r.message.shopping_cart_menu);
-					}					
+					}
 					if(opts.callback)
 						opts.callback(r);
 				}
@@ -63,11 +63,11 @@
 
 	set_cart_count: function() {
 		var cart_count = getCookie("cart_count");
-		
+
 		if(cart_count) {
-			$(".shopping-cart").toggle(true);	
-		}		
-		
+			$(".shopping-cart").toggleClass('hidden', true);
+		}
+
 		var $cart = $('.cart-icon');
 		var $badge = $cart.find("#cart-count");
 
@@ -88,7 +88,7 @@
 			$badge.remove();
 		}
 	},
-	
+
 	shopping_cart_update: function(item_code, newVal, cart_dropdown) {
 		frappe.freeze();
 		shopping_cart.update_cart({
@@ -103,20 +103,20 @@
 					$(".cart-tax-items").html(r.message.taxes);
 					if (cart_dropdown != true) {
 						$(".cart-icon").hide();
-					}					
+					}
 				}
 			},
 		});
 	},
-	
-	
+
+
 	bind_dropdown_cart_buttons: function() {
 		$(".cart-icon").on('click', '.number-spinner button', function () {
 			var btn = $(this),
 				input = btn.closest('.number-spinner').find('input'),
 				oldValue = input.val().trim(),
 				newVal = 0;
-			
+
 				if (btn.attr('data-dir') == 'up') {
 					newVal = parseInt(oldValue) + 1;
 				} else {
@@ -125,11 +125,11 @@
 					}
 			}
 			input.val(newVal);
-			var item_code = input.attr("data-item-code"); 
+			var item_code = input.attr("data-item-code");
 			shopping_cart.shopping_cart_update(item_code, newVal, true);
 			return false;
 		});
-		
+
 	},
-	
+
 });
diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less
index 37d69e0..ce36e5f 100644
--- a/erpnext/public/less/website.less
+++ b/erpnext/public/less/website.less
@@ -8,6 +8,10 @@
 	line-height: 200%;
 }
 
+.web-page-content {
+	margin-bottom: 30px;
+}
+
 .item-stock {
 	margin-bottom: 10px !important;
 }
diff --git a/erpnext/schools/doctype/student_admission/student_admission.js b/erpnext/schools/doctype/student_admission/student_admission.js
index 48f4c46..d7f7454 100644
--- a/erpnext/schools/doctype/student_admission/student_admission.js
+++ b/erpnext/schools/doctype/student_admission/student_admission.js
@@ -8,7 +8,7 @@
 			frm.refresh_field("route");
 		}
 	},
-	
+
 	academic_year: function(frm) {
 		frm.trigger("program");
 	}
diff --git a/erpnext/schools/doctype/student_admission/student_admission.json b/erpnext/schools/doctype/student_admission/student_admission.json
index 4eae29d..77a3236 100644
--- a/erpnext/schools/doctype/student_admission/student_admission.json
+++ b/erpnext/schools/doctype/student_admission/student_admission.json
@@ -1,8 +1,8 @@
 {
  "allow_copy": 0, 
  "allow_import": 0, 
- "allow_rename": 0, 
- "autoname": "field:route", 
+ "allow_rename": 1, 
+ "autoname": "", 
  "beta": 0, 
  "creation": "2016-09-13 03:05:27.154713", 
  "custom": 0, 
@@ -121,6 +121,32 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "naming_series_for_student_applicant", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Naming Series (for Student Applicant)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "publish", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -189,7 +215,7 @@
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -351,6 +377,32 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "eligibility", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Eligibility", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "hide_heading": 0, 
@@ -363,7 +415,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-10-03 15:08:48.020111", 
+ "modified": "2016-10-04 02:44:28.480942", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Admission", 
@@ -380,6 +432,7 @@
    "export": 1, 
    "if_owner": 0, 
    "import": 0, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
diff --git a/erpnext/schools/doctype/student_admission/student_admission.py b/erpnext/schools/doctype/student_admission/student_admission.py
index c4384e2..3df113a 100644
--- a/erpnext/schools/doctype/student_admission/student_admission.py
+++ b/erpnext/schools/doctype/student_admission/student_admission.py
@@ -11,15 +11,18 @@
 	website = frappe._dict(
 		template = "templates/generators/student_admission.html",
 		condition_field = "publish",
-		page_title_field = "route"
+		page_title_field = "title"
 	)
 
+	def autoname(self):
+		self.name = self.get_title()
+		self.title = self.name
+
 	def get_context(self, context):
 		context.parents = [{'name': 'admissions', 'title': _('All Student Admissions') }]
-		
-	def validate(self):
-		if not self.title:
-			self.title = self.program + " admissions for " + self.academic_year
+
+	def get_title(self):
+		return _("Admissions for {0}") + self.academic_year
 
 def get_list_context(context):
 	context.title = _("Student Admissions")
diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.json b/erpnext/schools/doctype/student_applicant/student_applicant.json
index d926bd9..55064ed 100644
--- a/erpnext/schools/doctype/student_applicant/student_applicant.json
+++ b/erpnext/schools/doctype/student_applicant/student_applicant.json
@@ -94,6 +94,33 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "student_admission", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Student Admission", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Student Admission", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "program", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -182,7 +209,7 @@
    "label": "Naming Series", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "AP.", 
+   "options": "AP", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -891,7 +918,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-09-23 14:15:25.153128", 
+ "modified": "2016-10-04 02:46:20.913741", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Applicant", 
@@ -908,6 +935,7 @@
    "export": 1, 
    "if_owner": 0, 
    "import": 1, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.py b/erpnext/schools/doctype/student_applicant/student_applicant.py
index 01ddefa..eead6b0 100644
--- a/erpnext/schools/doctype/student_applicant/student_applicant.py
+++ b/erpnext/schools/doctype/student_applicant/student_applicant.py
@@ -8,6 +8,18 @@
 from frappe.model.document import Document
 
 class StudentApplicant(Document):
+	def autoname(self):
+		from frappe.model.naming import set_name_by_naming_series
+		if self.student_admission:
+			naming_series = frappe.db.get_value('Student Admission', self.student_admission,
+				'naming_series_for_student_applicant')
+			print naming_series
+
+			if naming_series:
+				self.naming_series = naming_series
+
+		set_name_by_naming_series(self)
+
 	def validate(self):
 		self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name]))
 
diff --git a/erpnext/setup/doctype/email_digest/templates/default.html b/erpnext/setup/doctype/email_digest/templates/default.html
index 0500dc1..78acbd9 100644
--- a/erpnext/setup/doctype/email_digest/templates/default.html
+++ b/erpnext/setup/doctype/email_digest/templates/default.html
@@ -43,7 +43,8 @@
 
 <!-- issue list -->
 {% if issue_list %}
-<h4 style="{{ section_head }}">{{ _("Open Issues ") }}<span class="badge">({{ issue_count }})</span></h4>
+<h4 style="{{ section_head }}">{{ _("Open Issues ") }}
+	<span class="badge">({{ issue_count }})</span></h4>
 <div>
 {% for t in issue_list %}
     <div style="{{ line_item }}">
@@ -66,7 +67,8 @@
 
 <!-- project list -->
 {% if project_list %}
-<h4 style="{{ section_head }}">{{ _("Open Projects ") }}<span class="badge">({{ project_count }})</span></h4>
+<h4 style="{{ section_head }}">{{ _("Open Projects ") }}
+	<span class="badge">({{ project_count }})</span></h4>
 <div>
 {% for t in project_list %}
     <div style="{{ line_item }}">
@@ -92,7 +94,8 @@
 
 <!-- events -->
 {% if events %}
-<h4 style="{{ section_head }}">{{ _("Upcoming Calendar Events ") }}<span class="badge">({{ event_count }})</span></h4>
+<h4 style="{{ section_head }}">{{ _("Upcoming Calendar Events ") }}
+	<span class="badge">({{ event_count }})</span></h4>
 <div>
 {% for e in events %}
     {% if loop.index==1 or events[loop.index-1].date != e.date %}
@@ -124,7 +127,8 @@
 
 <!-- todo list -->
 {% if todo_list %}
-<h4 style="{{ section_head }}">{{ _("Open To Do ") }}<span class="badge">({{ todo_count }})</span></h4>
+<h4 style="{{ section_head }}">{{ _("Open To Do ") }}
+	<span class="badge">({{ todo_count }})</span></h4>
 <div>
 {% for t in todo_list %}
     <div style="{{ line_item }}">
diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py
index d382d24..60a1270 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.py
+++ b/erpnext/setup/doctype/naming_series/naming_series.py
@@ -25,6 +25,7 @@
 				options = self.get_options(d)
 			except frappe.DoesNotExistError:
 				frappe.msgprint('Unable to find DocType {0}'.format(d))
+				#frappe.pass_does_not_exist_error()
 				continue
 
 			if options:
diff --git a/erpnext/templates/generators/student_admission.html b/erpnext/templates/generators/student_admission.html
index edb08c8..98b9b4a 100644
--- a/erpnext/templates/generators/student_admission.html
+++ b/erpnext/templates/generators/student_admission.html
@@ -19,7 +19,9 @@
 {%- if application_form_route -%}
 <p>
 	<a class='btn btn-primary'
-	href='/{{ doc.application_form_route }}?program={{ doc.program }}&academic_year={{ doc.academic_year }}&new=1'>
+	href='/{{ doc.application_form_route }}?new=1&student_admission={{ doc.name }}
+		{%- if doc.program -%}&program={{ doc.program }}{%- endif -%}
+		{%- if doc.academic_year -%}&academic_year={{ doc.academic_year }}{%- endif -%}'>
 	{{ _("Apply Now") }}</a>
 </p>
 {% endif %}
diff --git a/erpnext/templates/includes/navbar/navbar_items.html b/erpnext/templates/includes/navbar/navbar_items.html
index c7af2fd..f0c780d 100644
--- a/erpnext/templates/includes/navbar/navbar_items.html
+++ b/erpnext/templates/includes/navbar/navbar_items.html
@@ -1,7 +1,7 @@
 {% extends 'frappe/templates/includes/navbar/navbar_items.html' %}
 
 {% block navbar_right_extension %}
-	<li class="shopping-cart">
+	<li class="shopping-cart hidden">
 		<div class="cart-icon small">
 			<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="navLogin">
 				Cart <span class="badge-wrapper" id="cart-count"></span>