mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-24 12:36:37 +00:00
chore: whitespace trimming
This commit is contained in:
@@ -18,7 +18,7 @@ class TestEmployeeReminders(unittest.TestCase):
|
||||
# Create a test holiday list
|
||||
test_holiday_dates = cls.get_test_holiday_dates()
|
||||
test_holiday_list = make_holiday_list(
|
||||
'TestHolidayRemindersList',
|
||||
'TestHolidayRemindersList',
|
||||
holiday_dates=[
|
||||
{'holiday_date': test_holiday_dates[0], 'description': 'test holiday1'},
|
||||
{'holiday_date': test_holiday_dates[1], 'description': 'test holiday2'},
|
||||
@@ -49,8 +49,8 @@ class TestEmployeeReminders(unittest.TestCase):
|
||||
def get_test_holiday_dates(cls):
|
||||
today_date = getdate()
|
||||
return [
|
||||
today_date,
|
||||
today_date-timedelta(days=4),
|
||||
today_date,
|
||||
today_date-timedelta(days=4),
|
||||
today_date-timedelta(days=3),
|
||||
today_date+timedelta(days=1),
|
||||
today_date+timedelta(days=3),
|
||||
@@ -63,7 +63,7 @@ class TestEmployeeReminders(unittest.TestCase):
|
||||
|
||||
def test_is_holiday(self):
|
||||
from erpnext.hr.doctype.employee.employee import is_holiday
|
||||
|
||||
|
||||
self.assertTrue(is_holiday(self.test_employee.name))
|
||||
self.assertTrue(is_holiday(self.test_employee.name, date=self.test_holiday_dates[1]))
|
||||
self.assertFalse(is_holiday(self.test_employee.name, date=getdate()-timedelta(days=1)))
|
||||
@@ -118,7 +118,7 @@ class TestEmployeeReminders(unittest.TestCase):
|
||||
|
||||
email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True)
|
||||
self.assertTrue("Subject: Work Anniversary Reminder" in email_queue[0].message)
|
||||
|
||||
|
||||
def test_send_holidays_reminder_in_advance(self):
|
||||
from erpnext.hr.utils import get_holidays_for_employee
|
||||
from erpnext.hr.doctype.employee.employee_reminders import send_holidays_reminder_in_advance
|
||||
@@ -133,10 +133,10 @@ class TestEmployeeReminders(unittest.TestCase):
|
||||
holidays = get_holidays_for_employee(
|
||||
self.test_employee.get('name'),
|
||||
getdate(), getdate() + timedelta(days=3),
|
||||
only_non_weekly=True,
|
||||
only_non_weekly=True,
|
||||
raise_exception=False
|
||||
)
|
||||
|
||||
|
||||
send_holidays_reminder_in_advance(
|
||||
self.test_employee.get('name'),
|
||||
holidays
|
||||
@@ -158,7 +158,7 @@ class TestEmployeeReminders(unittest.TestCase):
|
||||
|
||||
email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True)
|
||||
self.assertTrue(len(email_queue) > 0)
|
||||
|
||||
|
||||
def test_advance_holiday_reminders_weekly(self):
|
||||
from erpnext.hr.doctype.employee.employee_reminders import send_reminders_in_advance_weekly
|
||||
# Get HR settings and enable advance holiday reminders
|
||||
|
||||
@@ -144,20 +144,20 @@ class TestExpenseClaim(unittest.TestCase):
|
||||
expense_claim = make_expense_claim(payable_account, 5500, 5500, "_Test Company", "Travel Expenses - _TC")
|
||||
expense_claim.save()
|
||||
expense_claim.submit()
|
||||
|
||||
|
||||
# Payment entry 1: paying 500
|
||||
make_payment_entry(expense_claim, payable_account,500)
|
||||
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
|
||||
self.assertEqual(outstanding_amount, 5000)
|
||||
self.assertEqual(total_amount_reimbursed, 500)
|
||||
|
||||
|
||||
# Payment entry 1: paying 2000
|
||||
make_payment_entry(expense_claim, payable_account,2000)
|
||||
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
|
||||
self.assertEqual(outstanding_amount, 3000)
|
||||
self.assertEqual(total_amount_reimbursed, 2500)
|
||||
|
||||
# Payment entry 1: paying 3000
|
||||
|
||||
# Payment entry 1: paying 3000
|
||||
make_payment_entry(expense_claim, payable_account,3000)
|
||||
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
|
||||
self.assertEqual(outstanding_amount, 0)
|
||||
@@ -221,7 +221,7 @@ def get_outstanding_and_total_reimbursed_amounts(expense_claim):
|
||||
outstanding_amount = flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_sanctioned_amount")) - \
|
||||
flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_amount_reimbursed"))
|
||||
total_amount_reimbursed = flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_amount_reimbursed"))
|
||||
|
||||
|
||||
return outstanding_amount,total_amount_reimbursed
|
||||
|
||||
def make_payment_entry(expense_claim, payable_account, amt):
|
||||
@@ -234,5 +234,5 @@ def make_payment_entry(expense_claim, payable_account, amt):
|
||||
pe.paid_to = payable_account
|
||||
pe.references[0].allocated_amount = amt
|
||||
pe.insert()
|
||||
pe.submit()
|
||||
|
||||
pe.submit()
|
||||
|
||||
|
||||
@@ -450,9 +450,9 @@ def get_sal_slip_total_benefit_given(employee, payroll_period, component=False):
|
||||
|
||||
def get_holiday_dates_for_employee(employee, start_date, end_date):
|
||||
"""return a list of holiday dates for the given employee between start_date and end_date"""
|
||||
# return only date
|
||||
holidays = get_holidays_for_employee(employee, start_date, end_date)
|
||||
|
||||
# return only date
|
||||
holidays = get_holidays_for_employee(employee, start_date, end_date)
|
||||
|
||||
return [cstr(h.holiday_date) for h in holidays]
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ def get_holidays_for_employee(employee, start_date, end_date, raise_exception=Tr
|
||||
`raise_exception` (bool)
|
||||
`only_non_weekly` (bool)
|
||||
|
||||
return: list of dicts with `holiday_date` and `description`
|
||||
return: list of dicts with `holiday_date` and `description`
|
||||
"""
|
||||
holiday_list = get_holiday_list_for_employee(employee, raise_exception=raise_exception)
|
||||
|
||||
@@ -481,11 +481,11 @@ def get_holidays_for_employee(employee, start_date, end_date, raise_exception=Tr
|
||||
filters['weekly_off'] = False
|
||||
|
||||
holidays = frappe.get_all(
|
||||
'Holiday',
|
||||
'Holiday',
|
||||
fields=['description', 'holiday_date'],
|
||||
filters=filters
|
||||
)
|
||||
|
||||
|
||||
return holidays
|
||||
|
||||
@erpnext.allow_regional
|
||||
|
||||
Reference in New Issue
Block a user