Removed from Leave Block List and Monthly Attendance List
This commit is contained in:
parent
13bb2ba779
commit
d9cc14ddd5
@ -18,6 +18,7 @@
|
|||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Leave Block List Name",
|
"label": "Leave Block List Name",
|
||||||
@ -25,29 +26,7 @@
|
|||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"read_only": 0,
|
"print_hide_if_no_value": 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,
|
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
@ -63,6 +42,7 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
@ -71,6 +51,7 @@
|
|||||||
"options": "Company",
|
"options": "Company",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
@ -87,6 +68,7 @@
|
|||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Applies to Company",
|
"label": "Applies to Company",
|
||||||
@ -94,6 +76,7 @@
|
|||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -110,6 +93,7 @@
|
|||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Block Days",
|
"label": "Block Days",
|
||||||
@ -117,6 +101,7 @@
|
|||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -132,6 +117,7 @@
|
|||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Leave Block List Dates",
|
"label": "Leave Block List Dates",
|
||||||
@ -140,6 +126,7 @@
|
|||||||
"options": "Leave Block List Date",
|
"options": "Leave Block List Date",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -156,6 +143,7 @@
|
|||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Allow Users",
|
"label": "Allow Users",
|
||||||
@ -163,6 +151,7 @@
|
|||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -178,6 +167,7 @@
|
|||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Leave Block List Allowed",
|
"label": "Leave Block List Allowed",
|
||||||
@ -186,6 +176,7 @@
|
|||||||
"options": "Leave Block List Allow",
|
"options": "Leave Block List Allow",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -204,7 +195,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2015-11-16 06:29:49.553862",
|
"modified": "2016-03-07 00:48:25.784577",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Leave Block List",
|
"name": "Leave Block List",
|
||||||
@ -232,5 +223,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"read_only_onload": 0
|
"read_only_onload": 0,
|
||||||
|
"sort_order": "ASC"
|
||||||
}
|
}
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from erpnext.accounts.utils import validate_fiscal_year
|
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
@ -14,8 +13,6 @@ class LeaveBlockList(Document):
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
dates = []
|
dates = []
|
||||||
for d in self.get("leave_block_list_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
|
# date is not repeated
|
||||||
if d.block_date in dates:
|
if d.block_date in dates:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
|
||||||
frappe.query_reports["Monthly Attendance Sheet"] = {
|
frappe.query_reports["Monthly Attendance Sheet"] = {
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
@ -12,11 +13,10 @@ frappe.query_reports["Monthly Attendance Sheet"] = {
|
|||||||
"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
|
"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"fiscal_year",
|
"fieldname":"year",
|
||||||
"label": __("Fiscal Year"),
|
"label": __("Year"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Select",
|
||||||
"options": "Fiscal Year",
|
"reqd": 1
|
||||||
"default": sys_defaults.fiscal_year,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"employee",
|
"fieldname":"employee",
|
||||||
@ -29,7 +29,20 @@ frappe.query_reports["Monthly Attendance Sheet"] = {
|
|||||||
"label": __("Company"),
|
"label": __("Company"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Company",
|
"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();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
]
|
|
||||||
}
|
}
|
@ -69,23 +69,15 @@ def get_attendance_list(conditions, filters):
|
|||||||
return att_map
|
return att_map
|
||||||
|
|
||||||
def get_conditions(filters):
|
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)
|
msgprint(_("Please select month and year"), raise_exception=1)
|
||||||
|
|
||||||
filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
||||||
"Dec"].index(filters.month) + 1
|
"Dec"].index(filters.month) + 1
|
||||||
|
|
||||||
year_start_date, year_end_date = frappe.db.get_value("Fiscal Year", filters.fiscal_year,
|
filters["total_days_in_month"] = monthrange(cint(filters.year), filters.month)[1]
|
||||||
["year_start_date", "year_end_date"])
|
|
||||||
|
|
||||||
if filters.month >= year_start_date.strftime("%m"):
|
conditions = " and month(att_date) = %(month)s and year(att_date) = %(year)s"
|
||||||
year = year_start_date.strftime("%Y")
|
|
||||||
else:
|
|
||||||
year = year_end_date.strftime("%Y")
|
|
||||||
|
|
||||||
filters["total_days_in_month"] = monthrange(cint(year), filters.month)[1]
|
|
||||||
|
|
||||||
conditions = " and month(att_date) = %(month)s and fiscal_year = %(fiscal_year)s"
|
|
||||||
|
|
||||||
if filters.get("company"): conditions += " and company = %(company)s"
|
if filters.get("company"): conditions += " and company = %(company)s"
|
||||||
if filters.get("employee"): conditions += " and employee = %(employee)s"
|
if filters.get("employee"): conditions += " and employee = %(employee)s"
|
||||||
@ -100,3 +92,8 @@ def get_employee_details():
|
|||||||
emp_map.setdefault(d.name, d)
|
emp_map.setdefault(d.name, d)
|
||||||
|
|
||||||
return emp_map
|
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)
|
Loading…
x
Reference in New Issue
Block a user