Removed from Leave Block List and Monthly Attendance List
diff --git a/erpnext/hr/doctype/leave_block_list/leave_block_list.json b/erpnext/hr/doctype/leave_block_list/leave_block_list.json
index 7dc0dde..c1328fb 100644
--- a/erpnext/hr/doctype/leave_block_list/leave_block_list.json
+++ b/erpnext/hr/doctype/leave_block_list/leave_block_list.json
@@ -18,6 +18,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Leave Block List Name",
@@ -25,29 +26,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
- "read_only": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "fieldname": "year",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "in_filter": 0,
- "in_list_view": 1,
- "label": "Year",
- "length": 0,
- "no_copy": 0,
- "options": "Fiscal Year",
- "permlevel": 0,
- "print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -63,6 +42,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Company",
@@ -71,6 +51,7 @@
"options": "Company",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -87,6 +68,7 @@
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Applies to Company",
@@ -94,6 +76,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -110,6 +93,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Block Days",
@@ -117,6 +101,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -132,6 +117,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Leave Block List Dates",
@@ -140,6 +126,7 @@
"options": "Leave Block List Date",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -156,6 +143,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Allow Users",
@@ -163,6 +151,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -178,6 +167,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Leave Block List Allowed",
@@ -186,6 +176,7 @@
"options": "Leave Block List Allow",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -204,7 +195,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2015-11-16 06:29:49.553862",
+ "modified": "2016-03-07 00:48:25.784577",
"modified_by": "Administrator",
"module": "HR",
"name": "Leave Block List",
@@ -232,5 +223,6 @@
}
],
"read_only": 0,
- "read_only_onload": 0
+ "read_only_onload": 0,
+ "sort_order": "ASC"
}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/leave_block_list/leave_block_list.py b/erpnext/hr/doctype/leave_block_list/leave_block_list.py
index 5d913f2..9cb9fc0 100644
--- a/erpnext/hr/doctype/leave_block_list/leave_block_list.py
+++ b/erpnext/hr/doctype/leave_block_list/leave_block_list.py
@@ -5,7 +5,6 @@
from __future__ import unicode_literals
import frappe
-from erpnext.accounts.utils import validate_fiscal_year
from frappe import _
from frappe.model.document import Document
@@ -14,8 +13,6 @@
def validate(self):
dates = []
for d in self.get("leave_block_list_dates"):
- # validate fiscal year
- validate_fiscal_year(d.block_date, self.year, _("Block Date"))
# date is not repeated
if d.block_date in dates:
diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js
index 8f0db50..0057469 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js
@@ -1,6 +1,7 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
+
frappe.query_reports["Monthly Attendance Sheet"] = {
"filters": [
{
@@ -12,11 +13,10 @@
"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
},
{
- "fieldname":"fiscal_year",
- "label": __("Fiscal Year"),
- "fieldtype": "Link",
- "options": "Fiscal Year",
- "default": sys_defaults.fiscal_year,
+ "fieldname":"year",
+ "label": __("Year"),
+ "fieldtype": "Select",
+ "reqd": 1
},
{
"fieldname":"employee",
@@ -29,7 +29,20 @@
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
- "default": frappe.defaults.get_user_default("Company")
+ "default": frappe.defaults.get_user_default("Company"),
+ "reqd": 1
}
- ]
+ ],
+
+ "onload": function(me) {
+ return frappe.call({
+ method: "erpnext.hr.report.monthly_attendance_sheet.monthly_attendance_sheet.get_attendance_years",
+ callback: function(r) {
+ var year_filter = me.filters_by_name.year;
+ year_filter.df.options = r.message;
+ year_filter.set_options(r.message.split("\n")[0]);
+ year_filter.refresh();
+ }
+ });
+ }
}
\ No newline at end of file
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 fe11406..bc2e4c7 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
@@ -69,23 +69,15 @@
return att_map
def get_conditions(filters):
- if not (filters.get("month") and filters.get("fiscal_year")):
+ if not (filters.get("month") and filters.get("year")):
msgprint(_("Please select month and year"), raise_exception=1)
filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
"Dec"].index(filters.month) + 1
-
- year_start_date, year_end_date = frappe.db.get_value("Fiscal Year", filters.fiscal_year,
- ["year_start_date", "year_end_date"])
-
- if filters.month >= year_start_date.strftime("%m"):
- year = year_start_date.strftime("%Y")
- else:
- year = year_end_date.strftime("%Y")
- filters["total_days_in_month"] = monthrange(cint(year), filters.month)[1]
+ filters["total_days_in_month"] = monthrange(cint(filters.year), filters.month)[1]
- conditions = " and month(att_date) = %(month)s and fiscal_year = %(fiscal_year)s"
+ conditions = " and month(att_date) = %(month)s and year(att_date) = %(year)s"
if filters.get("company"): conditions += " and company = %(company)s"
if filters.get("employee"): conditions += " and employee = %(employee)s"
@@ -100,3 +92,8 @@
emp_map.setdefault(d.name, d)
return emp_map
+
+@frappe.whitelist()
+def get_attendance_years():
+ year_list = frappe.db.sql_list("""select distinct YEAR(att_date) from tabAttendance ORDER BY YEAR(att_date)""")
+ return "\n".join(str(year) for year in year_list)
\ No newline at end of file