test: create leave type

This commit is contained in:
Mangesh-Khairnar 2019-04-11 00:20:32 +05:30
parent 7c6b6eae5b
commit bd3b3ea12c

View File

@ -2,6 +2,24 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
test_records = frappe.get_test_records('Leave Type')
from frappe import _
test_records = frappe.get_test_records('Leave Type')
def create_leave_type(**args):
if frappe.db.exists("Leave Type", args.leave_type_name):
return frappe.get_doc("Leave Type", args.leave_type_name)
leave_type = frappe.get_doc({
"doctype": "Leave Type",
"leave_type_name": args.leave_type_name or "_Test Leave Type",
"include_holiday": args.include_holidays or 1,
"allow_encashment": args.allow_encashment or 0,
"is_earned_leave": args.is_earned_leave or 0,
"is_lwp": args.is_lwp or 0,
"is_carry_forward": args.is_carry_forward or 0,
"carry_forward_leave_expiry": args.is_carry_forward or 0,
"encashment_threshold_days": args.encashment_threshold_days or 5,
"earning_component": "Leave Encashment"
})
return leave_type