mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-27 18:48:31 +00:00
test: test cases added for checking the base amounts in timesheet
(cherry picked from commit 4568114ba8)
This commit is contained in:
@@ -17,6 +17,15 @@ class TestTimesheet(unittest.TestCase):
|
||||
def setUp(self):
|
||||
frappe.db.delete("Timesheet")
|
||||
|
||||
def test_timesheet_base_amount(self):
|
||||
emp = make_employee("test_employee_6@salary.com")
|
||||
timesheet = make_timesheet(emp, simulate=True, is_billable=1)
|
||||
|
||||
self.assertEqual(timesheet.time_logs[0].base_billing_rate, 50)
|
||||
self.assertEqual(timesheet.time_logs[0].base_costing_rate, 20)
|
||||
self.assertEqual(timesheet.time_logs[0].base_billing_amount, 100)
|
||||
self.assertEqual(timesheet.time_logs[0].base_costing_amount, 40)
|
||||
|
||||
def test_timesheet_billing_amount(self):
|
||||
emp = make_employee("test_employee_6@salary.com")
|
||||
timesheet = make_timesheet(emp, simulate=True, is_billable=1)
|
||||
@@ -236,4 +245,5 @@ def make_timesheet(
|
||||
def update_activity_type(activity_type):
|
||||
activity_type = frappe.get_doc("Activity Type", activity_type)
|
||||
activity_type.billing_rate = 50.0
|
||||
activity_type.costing_rate = 20.0
|
||||
activity_type.save(ignore_permissions=True)
|
||||
|
||||
@@ -91,11 +91,6 @@ class TimesheetDetail(Document):
|
||||
|
||||
self.billing_amount = self.billing_rate * (self.billing_hours or 0)
|
||||
self.costing_amount = self.costing_rate * (self.hours or 0)
|
||||
exchange_rate = flt(frappe.get_value("Timesheet", self.parent, "exchange_rate")) or 1.0
|
||||
self.base_billing_rate = flt(self.billing_rate) * exchange_rate
|
||||
self.base_costing_rate = flt(self.costing_rate) * exchange_rate
|
||||
self.base_billing_amount = flt(self.billing_amount) * exchange_rate
|
||||
self.base_costing_amount = flt(self.costing_amount) * exchange_rate
|
||||
|
||||
def validate_dates(self):
|
||||
"""Validate that to_time is not before from_time."""
|
||||
|
||||
Reference in New Issue
Block a user