コード例 #1
0
ファイル: api.py プロジェクト: ptdas/eSalesApp
def validate_block_days(employee, company, from_date, to_date, status):
    block_dates = get_applicable_block_dates(from_date, to_date, employee,
                                             company)

    if block_dates and status == "Approved":
        return "You are not authorized to approve leaves on Block Dates"
    return ""
コード例 #2
0
	def validate_block_days(self):
		block_dates = get_applicable_block_dates(
			self.from_date, self.to_date, self.employee, self.company
		)

		if block_dates and self.status == "Approved":
			frappe.throw(_("You are not authorized to approve leaves on Block Dates"), LeaveDayBlockedError)
コード例 #3
0
	def show_block_day_warning(self):
		block_dates = get_applicable_block_dates(self.from_date, self.to_date,
			self.employee, self.company, all_lists=True)

		if block_dates:
			frappe.msgprint(_("Warning: Leave application contains following block dates") + ":")
			for d in block_dates:
				frappe.msgprint(formatdate(d.block_date) + ": " + d.reason)
コード例 #4
0
ファイル: leave_application.py プロジェクト: ci2014/erpnext
	def show_block_day_warning(self):
		block_dates = get_applicable_block_dates(self.from_date, self.to_date,
			self.employee, self.company, all_lists=True)

		if block_dates:
			frappe.msgprint(_("Warning: Leave application contains following block dates") + ":")
			for d in block_dates:
				frappe.msgprint(formatdate(d.block_date) + ": " + d.reason)
コード例 #5
0
 def test_get_applicable_block_dates_for_allowed_user(self):
     frappe.set_user("*****@*****.**")
     frappe.db.set_value("Department", "_Test Department 1",
                         "leave_block_list", "_Test Leave Block List")
     self.assertEquals([], [
         d.block_date
         for d in get_applicable_block_dates("2013-01-01", "2013-01-03")
     ])
コード例 #6
0
 def test_get_applicable_block_dates_all_lists(self):
     frappe.set_user("*****@*****.**")
     frappe.db.set_value("Department", "_Test Department 1",
                         "leave_block_list", "_Test Leave Block List")
     self.assertTrue("2013-01-02" in [
         d.block_date for d in get_applicable_block_dates(
             "2013-01-01", "2013-01-03", all_lists=True)
     ])
コード例 #7
0
def show_block_day_warning(employee,company,from_date, to_date):
	block_dates = get_applicable_block_dates(from_date, to_date, employee, company, all_lists=True)
	if block_dates:
		warning = "Warning: Leave application contains following block dates\n"
		for d in block_dates:
			warning += formatdate(d.block_date) + ": " + d.reason
		return warning
	return ""
コード例 #8
0
 def test_get_applicable_block_dates(self):
     frappe.set_user("*****@*****.**")
     frappe.db.set_value("Department", "_Test Department - _TC",
                         "leave_block_list", "_Test Leave Block List")
     self.assertTrue(
         getdate("2013-01-02") in [
             d.block_date
             for d in get_applicable_block_dates("2013-01-01", "2013-01-03")
         ])
コード例 #9
0
ファイル: leave_application.py プロジェクト: SAJOIJOM/erpnext
	def validate_block_days(self):
		from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates

		block_dates = get_applicable_block_dates(self.from_date, self.to_date,
			self.employee, self.company)

		if block_dates:
			if self.status == "Approved":
				frappe.throw(_("Cannot approve leave as you are not authorized to approve leaves on Block Dates"),
					LeaveDayBlockedError)
コード例 #10
0
	def validate_block_days(self):
		from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates

		block_dates = get_applicable_block_dates(self.from_date, self.to_date,
			self.employee, self.company)

		if block_dates:
			if self.status == "Approved":
				frappe.throw(_("Cannot approve leave as you are not authorized to approve leaves on Block Dates"),
					LeaveDayBlockedError)
コード例 #11
0
ファイル: leave_application.py プロジェクト: SAJOIJOM/erpnext
def add_block_dates(events, start, end, employee, company):
	# block days
	from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates

	cnt = 0
	block_dates = get_applicable_block_dates(start, end, employee, company, all_lists=True)

	for block_date in block_dates:
		events.append({
			"doctype": "Leave Block List Date",
			"from_date": block_date.block_date,
			"title": _("Leave Blocked") + ": " + block_date.reason,
			"name": "_" + str(cnt),
		})
		cnt+=1
コード例 #12
0
def add_block_dates(events, start, end, employee, company):
	# block days
	from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates

	cnt = 0
	block_dates = get_applicable_block_dates(start, end, employee, company, all_lists=True)

	for block_date in block_dates:
		events.append({
			"doctype": "Leave Block List Date",
			"from_date": block_date.block_date,
			"title": _("Leave Blocked") + ": " + block_date.reason,
			"name": "_" + str(cnt),
		})
		cnt+=1
コード例 #13
0
ファイル: leave_application.py プロジェクト: ddimmich/erpnext
    def show_block_day_warning(self):
        from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates

        block_dates = get_applicable_block_dates(self.doc.from_date,
                                                 self.doc.to_date,
                                                 self.doc.employee,
                                                 self.doc.company,
                                                 all_lists=True)

        if block_dates:
            frappe.msgprint(
                _("Warning: Leave application contains following block dates")
                + ":")
            for d in block_dates:
                frappe.msgprint(formatdate(d.block_date) + ": " + d.reason)
コード例 #14
0
ファイル: leave_application.py プロジェクト: ci2014/erpnext
	def validate_block_days(self):
		block_dates = get_applicable_block_dates(self.from_date, self.to_date,
			self.employee, self.company)

		if block_dates and self.status == "Approved":
			frappe.throw(_("You are not authorized to approve leaves on Block Dates"), LeaveDayBlockedError)
コード例 #15
0
	def test_get_applicable_block_dates_all_lists(self):
		frappe.set_user("*****@*****.**")
		frappe.db.set_value("Department", "_Test Department 1", "leave_block_list",
			"_Test Leave Block List")
		self.assertTrue(getdate("2013-01-02") in
			[d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03", all_lists=True)])
コード例 #16
0
	def test_get_applicable_block_dates_for_allowed_user(self):
		frappe.set_user("*****@*****.**")
		frappe.db.set_value("Department", "_Test Department 1", "leave_block_list",
			"_Test Leave Block List")
		self.assertEquals([], [d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03")])