mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-22 19:55:29 +00:00
fix(test): calculate total pending days of depreciation correctly
This commit is contained in:
@@ -258,7 +258,11 @@ class DepreciationScheduleController(StraightLineMethod, WDVMethod):
|
||||
def get_total_pending_days_or_years(self):
|
||||
if cint(frappe.db.get_single_value("Accounts Settings", "calculate_depr_using_total_days")):
|
||||
last_depr_date = self.get_last_booked_depreciation_date()
|
||||
self.total_pending_days = date_diff(self.final_schedule_date, last_depr_date) + 1
|
||||
if last_depr_date:
|
||||
self.total_pending_days = date_diff(self.final_schedule_date, last_depr_date) + 1
|
||||
self.total_pending_days = date_diff(
|
||||
self.final_schedule_date, self.asset_doc.available_for_use_date
|
||||
)
|
||||
else:
|
||||
self.total_pending_years = self.pending_months / 12
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
|
||||
self.assertRaises(frappe.ValidationError, second_asset_depr_schedule.insert)
|
||||
|
||||
def test_daily_prorata_based_depr_on_sl_method(self):
|
||||
frappe.db.set_single_value("Accounts Settings", "calculate_depr_using_total_days", 0)
|
||||
asset = create_asset(
|
||||
calculate_depreciation=1,
|
||||
depreciation_method="Straight Line",
|
||||
|
||||
Reference in New Issue
Block a user