Merge pull request #5096 from nabinhait/test_case_fix

Test case fix
diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json
index d117d06..dd21b1f 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.json
+++ b/erpnext/crm/doctype/opportunity/opportunity.json
@@ -974,7 +974,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-03-03 06:13:49.728079", 
+ "modified": "2016-03-30 05:47:46.617670", 
  "modified_by": "Administrator", 
  "module": "CRM", 
  "name": "Opportunity", 
@@ -1027,5 +1027,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "timeline_field": "customer", 
- "title_field": "title"
+ "title_field": "title", 
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index b2351ac..9c532af 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -124,7 +124,8 @@
 	},
 	"User": {
 		"validate": "erpnext.hr.doctype.employee.employee.validate_employee_role",
-		"on_update": "erpnext.hr.doctype.employee.employee.update_user_permissions"
+		"on_update": "erpnext.hr.doctype.employee.employee.update_user_permissions",
+		"on_update": "erpnext.utilities.doctype.contact.contact.update_contact"
 	},
 	"Sales Taxes and Charges Template": {
 		"on_update": "erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings.validate_cart_settings"
diff --git a/erpnext/manufacturing/doctype/bom/bom.json b/erpnext/manufacturing/doctype/bom/bom.json
index bd379e2..e833e46 100644
--- a/erpnext/manufacturing/doctype/bom/bom.json
+++ b/erpnext/manufacturing/doctype/bom/bom.json
@@ -315,7 +315,7 @@
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -807,7 +807,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-03-18 05:09:50.749754", 
+ "modified": "2016-03-30 03:50:02.164476", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "BOM", 
@@ -858,5 +858,6 @@
  "read_only_onload": 0, 
  "search_fields": "item", 
  "sort_field": "modified", 
- "sort_order": "DESC"
+ "sort_order": "DESC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index 2697fd0..eaff27a 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -659,7 +659,7 @@
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -1431,7 +1431,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-03-18 08:37:08.747493", 
+ "modified": "2016-03-30 03:49:43.167729", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Entry", 
@@ -1523,5 +1523,6 @@
  "search_fields": "posting_date, from_warehouse, to_warehouse, purpose, remarks", 
  "sort_field": "modified", 
  "sort_order": "DESC", 
- "title_field": "title"
+ "title_field": "title", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/support/doctype/issue/issue.json b/erpnext/support/doctype/issue/issue.json
index 2591937..dea81dc 100644
--- a/erpnext/support/doctype/issue/issue.json
+++ b/erpnext/support/doctype/issue/issue.json
@@ -7,6 +7,7 @@
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
+ "document_type": "Setup", 
  "fields": [
   {
    "allow_on_submit": 0, 
@@ -702,7 +703,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-03-25 07:31:44.715945", 
+ "modified": "2016-03-30 05:47:37.280932", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Issue", 
@@ -735,5 +736,5 @@
  "sort_order": "ASC", 
  "timeline_field": "customer", 
  "title_field": "subject", 
- "track_seen": 0
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/templates/pages/edit-profile.html b/erpnext/templates/pages/edit-profile.html
deleted file mode 100644
index f10e0a3..0000000
--- a/erpnext/templates/pages/edit-profile.html
+++ /dev/null
@@ -1,55 +0,0 @@
-{% extends "templates/web.html" %}
-
-{% block title %} {{ "My Profile" }} {% endblock %}
-
-{% block header %}<h2>My Profile</h2>{% endblock %}
-
-{% block page_content %}
-<div class="user-content" style="max-width: 500px;">
-	<div class="alert alert-warning" id="message" style="display: none;"></div>
-	<form>
-		<fieldset>
-			<label>Full Name</label>
-			<input class="form-control" type="text" id="fullname" placeholder="Your Name">
-		</fieldset>
-		<fieldset>
-			<label>Company Name</label>
-			<input class="form-control" type="text" id="company_name" placeholder="Company Name" value="{{ company_name }}">
-		</fieldset>
-		<fieldset>
-			<label>Mobile No</label>
-			<input class="form-control" type="text" id="mobile_no" placeholder="Mobile No" value="{{ mobile_no }}">
-		</fieldset>
-		<fieldset>
-			<label>Phone</label>
-			<input class="form-control" type="text" id="phone" placeholder="Phone" value="{{ phone }}">
-		</fieldset>
-		<button id="update_user" type="submit" class="btn btn-default">Update</button>
-	</form>
-</div>
-<script>
-frappe.ready(function() {
-	$("#fullname").val(getCookie("full_name") || "");
-	$("#update_user").click(function() {
-		frappe.call({
-			method: "erpnext.templates.pages.edit_profile.update_user",
-			type: "POST",
-			args: {
-				fullname: $("#fullname").val(),
-				company_name: $("#company_name").val(),
-				mobile_no: $("#mobile_no").val(),
-				phone: $("#phone").val()
-			},
-			btn: this,
-			msg: $("#message"),
-			callback: function(r) {
-				if(!r.exc) $("#user-full-name").html($("#fullname").val());
-			}
-		});
-		return false;
-	})
-})
-</script>
-<!-- no-sidebar -->
-{% endblock %}
-
diff --git a/erpnext/templates/pages/edit_profile.py b/erpnext/templates/pages/edit_profile.py
deleted file mode 100644
index 5ab5545..0000000
--- a/erpnext/templates/pages/edit_profile.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import frappe
-from frappe import _
-from frappe.utils import cstr
-from erpnext.shopping_cart.cart import get_customer
-
-no_cache = 1
-no_sitemap = 1
-
-def get_context(context):
-	party = get_customer()
-	mobile_no, phone = frappe.db.get_value("Contact", {"email_id": frappe.session.user,
-		"customer": party.name}, ["mobile_no", "phone"])
-
-	return {
-		"company_name": cstr(party.customer_name if party.doctype == "Customer" else party.company_name),
-		"mobile_no": cstr(mobile_no),
-		"phone": cstr(phone)
-	}
-
-@frappe.whitelist()
-def update_user(fullname, password=None, company_name=None, mobile_no=None, phone=None):
-	from erpnext.shopping_cart.cart import update_party
-	update_party(fullname, company_name, mobile_no, phone)
-
-	if not fullname:
-		return _("Name is required")
-
-	frappe.db.set_value("User", frappe.session.user, "first_name", fullname)
-	frappe.local.cookie_manager.set_cookie("full_name", fullname)
-
-	return _("Updated")
diff --git a/erpnext/utilities/doctype/contact/contact.py b/erpnext/utilities/doctype/contact/contact.py
index dff05bc..ae2fdfb 100644
--- a/erpnext/utilities/doctype/contact/contact.py
+++ b/erpnext/utilities/doctype/contact/contact.py
@@ -92,3 +92,13 @@
 		"contact_department": contact.get("department")
 	}
 	return out
+
+def update_contact(doc, method):
+	'''Update contact when user is updated, if contact is found. Called via hooks'''
+	contact_name = frappe.db.get_value("Contact", {"email_id": doc.name})
+	if contact_name:
+		contact = frappe.get_doc("Contact", contact_name)
+		contact.first_name = doc.first_name
+		contact.last_name = doc.last_name
+		contact.phone = doc.phone
+		contact.save(ignore_permissions=True)