chore: use selectbox instead of checkbox

This commit is contained in:
Khushi Rawat
2024-10-16 23:44:02 +05:30
parent a671fe13d4
commit 7ba0015de6
6 changed files with 42 additions and 6 deletions

View File

@@ -724,7 +724,10 @@ def get_daily_prorata_based_straight_line_depr(
def get_daily_depr_amount(asset, row, schedule_idx, amount):
if cint(frappe.db.get_single_value("Accounts Settings", "calculate_depr_using_total_days")):
if (
frappe.db.get_single_value("Accounts Settings", "calculate_daily_depreciation_using")
== "Total days in depreciation period"
):
total_days = (
date_diff(
get_last_day(

View File

@@ -85,7 +85,9 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
self.assertEqual(schedules, expected_schedules)
def test_schedule_for_slm_for_existing_asset_daily_pro_rata_enabled(self):
frappe.db.set_single_value("Accounts Settings", "calculate_depr_using_total_days", 1)
frappe.db.set_single_value(
"Accounts Settings", "calculate_daily_depreciation_using", "Total days in depreciation period"
)
asset = create_asset(
calculate_depreciation=1,
depreciation_method="Straight Line",
@@ -123,7 +125,9 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
for d in get_depr_schedule(asset.name, "Draft")
]
self.assertEqual(schedules, expected_schedules)
frappe.db.set_single_value("Accounts Settings", "calculate_depr_using_total_days", 0)
frappe.db.set_single_value(
"Accounts Settings", "calculate_daily_depreciation_using", "Total years in depreciation period"
)
def test_schedule_for_slm_for_existing_asset(self):
asset = create_asset(
@@ -196,7 +200,9 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
# Enable Checkbox to Calculate depreciation using total days in depreciation period
def test_daily_prorata_based_depr_after_enabling_configuration(self):
frappe.db.set_single_value("Accounts Settings", "calculate_depr_using_total_days", 1)
frappe.db.set_single_value(
"Accounts Settings", "calculate_daily_depreciation_using", "Total days in depreciation period"
)
asset = create_asset(
calculate_depreciation=1,
@@ -254,7 +260,9 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
for d in get_depr_schedule(asset.name, "Draft")
]
self.assertEqual(schedules, expected_schedule)
frappe.db.set_single_value("Accounts Settings", "calculate_depr_using_total_days", 0)
frappe.db.set_single_value(
"Accounts Settings", "calculate_daily_depreciation_using", "Total years in depreciation period"
)
# Test for Written Down Value Method
# Frequency of deprciation = 3