Minor fixes
This commit is contained in:
parent
81706fdb46
commit
265426a5a6
@ -233,9 +233,9 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
|
|
||||||
holiday_list = frappe.get_doc(dict(
|
holiday_list = frappe.get_doc(dict(
|
||||||
doctype = 'Holiday List',
|
doctype = 'Holiday List',
|
||||||
name = 'test holiday list for optional holiday'
|
name = 'test holiday list for optional holiday',
|
||||||
from_date = year_start_date(),
|
from_date = year_start_date(),
|
||||||
from_date = year_end_date()
|
to_date = year_end_date(),
|
||||||
holidays = [
|
holidays = [
|
||||||
dict(holiday_date = today, description = 'test')
|
dict(holiday_date = today, description = 'test')
|
||||||
]
|
]
|
||||||
@ -276,12 +276,15 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
|
|
||||||
def test_leaves_allowed(self):
|
def test_leaves_allowed(self):
|
||||||
# TODO: test cannot allocate more than max leaves
|
# TODO: test cannot allocate more than max leaves
|
||||||
|
pass
|
||||||
|
|
||||||
def test_applicable_after(self):
|
def test_applicable_after(self):
|
||||||
# TODO: test not applicable until applicable working days
|
# TODO: test not applicable until applicable working days
|
||||||
|
pass
|
||||||
|
|
||||||
def test_max_continuous_leaves(self):
|
def test_max_continuous_leaves(self):
|
||||||
# TODO: test cannot take continuous leaves more than
|
# TODO: test cannot take continuous leaves more than
|
||||||
|
pass
|
||||||
|
|
||||||
def test_earned_leave(self):
|
def test_earned_leave(self):
|
||||||
leave_period = get_leave_period()
|
leave_period = get_leave_period()
|
||||||
|
@ -12,24 +12,24 @@ class SalaryStructureAssignment(Document):
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_dates()
|
self.validate_dates()
|
||||||
|
|
||||||
def validate_date(self):
|
def validate_dates(self):
|
||||||
joining_date, relieving_date = frappe.db.get_value("Employee", self.employee,
|
joining_date, relieving_date = frappe.db.get_value("Employee", self.employee,
|
||||||
["date_of_joining", "relieving_date"])
|
["date_of_joining", "relieving_date"])
|
||||||
|
|
||||||
if self.from_date:
|
if self.from_date:
|
||||||
if joining_date and getdate(self.from_date) < joining_date:
|
if joining_date and getdate(self.from_date) < joining_date:
|
||||||
frappe.throw(_("From Date {0} cannot be before employee's joining Date {2}")
|
frappe.throw(_("From Date {0} cannot be before employee's joining Date {1}")
|
||||||
.format(self.from_date, joining_date))
|
.format(self.from_date, joining_date))
|
||||||
if relieving_date and getdate(self.from_date) > relieving_date:
|
if relieving_date and getdate(self.from_date) > relieving_date:
|
||||||
frappe.throw(_("From Date {0} cannot be after employee's relieving Date {2}")
|
frappe.throw(_("From Date {0} cannot be after employee's relieving Date {1}")
|
||||||
.format(self.from_date, relieving_date))
|
.format(self.from_date, relieving_date))
|
||||||
|
|
||||||
if self.to_date:
|
if self.to_date:
|
||||||
if self.from_date and getdate(self.from_date) < getdate(self.to_date):
|
if self.from_date and getdate(self.from_date) > getdate(self.to_date):
|
||||||
frappe.throw(_("From Date {0} cannot be before To Date {2}")
|
frappe.throw(_("From Date {0} cannot be after To Date {1}")
|
||||||
.format(self.from_date, self.to_date))
|
.format(self.from_date, self.to_date))
|
||||||
if relieving_date and getdate(self.to_date) > relieving_date:
|
if relieving_date and getdate(self.to_date) > relieving_date:
|
||||||
frappe.throw(_("To Date {0} cannot be after employee's relieving Date {2}")
|
frappe.throw(_("To Date {0} cannot be after employee's relieving Date {1}")
|
||||||
.format(self.to_date, relieving_date))
|
.format(self.to_date, relieving_date))
|
||||||
|
|
||||||
def validate_duplicate_assignments(self):
|
def validate_duplicate_assignments(self):
|
||||||
|
@ -7,9 +7,9 @@ import frappe
|
|||||||
def execute():
|
def execute():
|
||||||
frappe.reload_doc("hr", "doctype", "salary_structure_assignment")
|
frappe.reload_doc("hr", "doctype", "salary_structure_assignment")
|
||||||
for d in frappe.db.sql("""
|
for d in frappe.db.sql("""
|
||||||
select * from `tabSalary Structure Employee` sse, `tabSalary Structure` ss
|
select sse.*, ss.company from `tabSalary Structure Employee` sse, `tabSalary Structure` ss
|
||||||
where ss.name = sse.parent""", as_dict=1):
|
where ss.name = sse.parent""", as_dict=1):
|
||||||
|
print(d)
|
||||||
s = frappe.new_doc("Salary Structure Assignment")
|
s = frappe.new_doc("Salary Structure Assignment")
|
||||||
s.employee = d.employee
|
s.employee = d.employee
|
||||||
s.employee_name = d.employee_name
|
s.employee_name = d.employee_name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user