mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 19:19:17 +00:00
adding block list, part 1
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:13",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-01-22 14:46:41",
|
||||
"modified": "2013-02-04 15:34:55",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -57,6 +57,14 @@
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"description": "Days for which Holidays are blocked for this department.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "holiday_block_list",
|
||||
"fieldtype": "Link",
|
||||
"label": "Holiday Block List",
|
||||
"options": "Holiday Block List"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "System Manager"
|
||||
|
||||
0
hr/doctype/holiday_block_list/__init__.py
Normal file
0
hr/doctype/holiday_block_list/__init__.py
Normal file
21
hr/doctype/holiday_block_list/holiday_block_list.py
Normal file
21
hr/doctype/holiday_block_list/holiday_block_list.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from accounts.utils import validate_fiscal_year
|
||||
from webnotes import _
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def validate(self):
|
||||
dates = []
|
||||
for d in self.doclist.get({"doctype":"Holiday Block List Date"}):
|
||||
# validate fiscal year
|
||||
validate_fiscal_year(d.block_date, self.doc.year, _("Block Date"))
|
||||
|
||||
# date is not repeated
|
||||
if d.block_date in dates:
|
||||
webnotes.msgprint(_("Date is repeated") + ":" + d.block_date, raise_exception=1)
|
||||
dates.append(d.block_date)
|
||||
66
hr/doctype/holiday_block_list/holiday_block_list.txt
Normal file
66
hr/doctype/holiday_block_list/holiday_block_list.txt
Normal file
@@ -0,0 +1,66 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-02-04 15:31:29",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-02-04 15:38:57",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "field:holiday_block_list_name",
|
||||
"description": "Block Holidays on important days.",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Master",
|
||||
"module": "HR",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Holiday Block List",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Holiday Block List",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"role": "HR User",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Holiday Block List"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "holiday_block_list_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Holiday Block List Name",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "year",
|
||||
"fieldtype": "Link",
|
||||
"label": "Year",
|
||||
"options": "Fiscal Year",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "holiday_block_list_dates",
|
||||
"fieldtype": "Table",
|
||||
"label": "Holiday Block List Dates",
|
||||
"options": "Holiday Block List Date"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
]
|
||||
0
hr/doctype/holiday_block_list_date/__init__.py
Normal file
0
hr/doctype/holiday_block_list_date/__init__.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -0,0 +1,40 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-02-04 15:33:14",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-02-04 15:36:10",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"istable": 1,
|
||||
"module": "HR",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Holiday Block List Date",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"width": "200px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Holiday Block List Date"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "block_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Block Date"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reason",
|
||||
"fieldtype": "Text",
|
||||
"label": "Reason"
|
||||
}
|
||||
]
|
||||
@@ -80,6 +80,11 @@ wn.module_page["HR"] = [
|
||||
"description":wn._("List of holidays."),
|
||||
doctype: "Holiday List"
|
||||
},
|
||||
{
|
||||
"label":wn._("Holiday Block List"),
|
||||
"description":wn._("Block leave applications by department."),
|
||||
doctype: "Holiday Block List"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user