Merge pull request #3567 from rmehta/item-description-mozilla-fix

[fix] item image in mozilla #3412 #3413
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index 64508b8..f32aeed 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -75,6 +75,11 @@
 			"items": [
 				{
 					"type": "doctype",
+					"name": "Company",
+					"description": _("Company (not Customer or Supplier) master.")
+				},
+				{
+					"type": "doctype",
 					"name": "Fiscal Year",
 					"description": _("Financial / accounting year.")
 				},
diff --git a/erpnext/config/setup.py b/erpnext/config/setup.py
index 961e4f7..a660942 100644
--- a/erpnext/config/setup.py
+++ b/erpnext/config/setup.py
@@ -110,43 +110,7 @@
 					"description": _("Setup SMS gateway settings")
 				},
 			]
-		},
-		{
-			"label": _("Masters"),
-			"icon": "icon-star",
-			"items": [
-				{
-					"type": "doctype",
-					"name": "Company",
-					"description": _("Company (not Customer or Supplier) master.")
-				},
-				{
-					"type": "doctype",
-					"name": "Item",
-					"description": _("Item master.")
-				},
-				{
-					"type": "doctype",
-					"name": "Customer",
-					"description": _("Customer master.")
-				},
-				{
-					"type": "doctype",
-					"name": "Supplier",
-					"description": _("Supplier master.")
-				},
-				{
-					"type": "doctype",
-					"name": "Contact",
-					"description": _("Contact master.")
-				},
-				{
-					"type": "doctype",
-					"name": "Address",
-					"description": _("Address master.")
-				},
-			]
-		},
+		}
 	]
 
 	for module, label, icon in (
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index cb0ce11..a2bb10c 100644
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -45,6 +45,10 @@
 		if self.user_id:
 			self.validate_for_enabled_user_id()
 			self.validate_duplicate_user_id()
+		else:
+			existing_user_id = frappe.db.get_value("Employee", self.name, "user_id")
+			if existing_user_id:
+				frappe.permissions.remove_user_permission("Employee", self.name, existing_user_id)
 
 	def on_update(self):
 		if self.user_id:
diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
index e012d78..f53acca 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
@@ -75,8 +75,20 @@
 	filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
 		"Dec"].index(filters["month"]) + 1
 
+	from frappe.model.document import Document
+	fiscal_years = frappe.get_doc("Fiscal Year",filters["fiscal_year"])
+	import datetime
+	year_start = fiscal_years.year_start_date.strftime("%Y")
+	year_end = fiscal_years.year_end_date.strftime("%Y")
+	dt_test = datetime.datetime.strptime(year_end + "-" + str(100+int(filters["month"]))[2:3] + "-01", "%Y-%m-%d")
+	date_test = datetime.date(dt_test.year, dt_test.month, dt_test.day)
+	if date_test > fiscal_years.year_end_date:
+		year_target = year_start
+	else:
+		year_target = year_end
+
 	from calendar import monthrange
-	filters["total_days_in_month"] = monthrange(cint(filters["fiscal_year"].split("-")[-1]),
+	filters["total_days_in_month"] = monthrange(cint(year_target),
 		filters["month"])[1]
 
 	conditions = " and month(att_date) = %(month)s and fiscal_year = %(fiscal_year)s"
diff --git a/erpnext/stock/doctype/manage_variants/manage_variants.js b/erpnext/stock/doctype/manage_variants/manage_variants.js
index ba5c46e..e8b7ade 100644
--- a/erpnext/stock/doctype/manage_variants/manage_variants.js
+++ b/erpnext/stock/doctype/manage_variants/manage_variants.js
@@ -3,7 +3,7 @@
 
 frappe.ui.form.on("Manage Variants", {
 	onload: function(frm) {
-		var df = frappe.meta.get_docfield("Variant Attribute", "attribute_value");
+		var df = frappe.meta.get_docfield("Variant Attribute", "attribute_value", "Manage Variants");
 		df.on_make = function(field) {
 			$(field.input_area).addClass("ui-front");
 			field.$input.autocomplete({