mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
chore: use selectbox instead of checkbox
This commit is contained in:
@@ -56,6 +56,7 @@
|
|||||||
"assets_tab",
|
"assets_tab",
|
||||||
"asset_settings_section",
|
"asset_settings_section",
|
||||||
"calculate_depr_using_total_days",
|
"calculate_depr_using_total_days",
|
||||||
|
"calculate_daily_depreciation_using",
|
||||||
"column_break_gjcc",
|
"column_break_gjcc",
|
||||||
"book_asset_depreciation_entry_automatically",
|
"book_asset_depreciation_entry_automatically",
|
||||||
"closing_settings_tab",
|
"closing_settings_tab",
|
||||||
@@ -489,6 +490,13 @@
|
|||||||
"fieldname": "create_pr_in_draft_status",
|
"fieldname": "create_pr_in_draft_status",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Create in Draft Status"
|
"label": "Create in Draft Status"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "Total years in depreciation period",
|
||||||
|
"fieldname": "calculate_daily_depreciation_using",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"label": "Calculate Daily Pro-rata Depreciation Using",
|
||||||
|
"options": "Total days in depreciation period\nTotal years in depreciation period"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "icon-cog",
|
"icon": "icon-cog",
|
||||||
@@ -496,7 +504,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-07-26 06:48:52.714630",
|
"modified": "2024-10-16 15:41:03.548766",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Accounts Settings",
|
"name": "Accounts Settings",
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ class AccountsSettings(Document):
|
|||||||
book_deferred_entries_based_on: DF.Literal["Days", "Months"]
|
book_deferred_entries_based_on: DF.Literal["Days", "Months"]
|
||||||
book_deferred_entries_via_journal_entry: DF.Check
|
book_deferred_entries_via_journal_entry: DF.Check
|
||||||
book_tax_discount_loss: DF.Check
|
book_tax_discount_loss: DF.Check
|
||||||
|
calculate_daily_depreciation_using: DF.Literal[
|
||||||
|
"Total days in depreciation period", "Total years in depreciation period"
|
||||||
|
]
|
||||||
calculate_depr_using_total_days: DF.Check
|
calculate_depr_using_total_days: DF.Check
|
||||||
check_supplier_invoice_uniqueness: DF.Check
|
check_supplier_invoice_uniqueness: DF.Check
|
||||||
create_pr_in_draft_status: DF.Check
|
create_pr_in_draft_status: DF.Check
|
||||||
|
|||||||
@@ -724,7 +724,10 @@ def get_daily_prorata_based_straight_line_depr(
|
|||||||
|
|
||||||
|
|
||||||
def get_daily_depr_amount(asset, row, schedule_idx, amount):
|
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 = (
|
total_days = (
|
||||||
date_diff(
|
date_diff(
|
||||||
get_last_day(
|
get_last_day(
|
||||||
|
|||||||
@@ -85,7 +85,9 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
|
|||||||
self.assertEqual(schedules, expected_schedules)
|
self.assertEqual(schedules, expected_schedules)
|
||||||
|
|
||||||
def test_schedule_for_slm_for_existing_asset_daily_pro_rata_enabled(self):
|
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(
|
asset = create_asset(
|
||||||
calculate_depreciation=1,
|
calculate_depreciation=1,
|
||||||
depreciation_method="Straight Line",
|
depreciation_method="Straight Line",
|
||||||
@@ -123,7 +125,9 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
|
|||||||
for d in get_depr_schedule(asset.name, "Draft")
|
for d in get_depr_schedule(asset.name, "Draft")
|
||||||
]
|
]
|
||||||
self.assertEqual(schedules, expected_schedules)
|
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):
|
def test_schedule_for_slm_for_existing_asset(self):
|
||||||
asset = create_asset(
|
asset = create_asset(
|
||||||
@@ -196,7 +200,9 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
|
|||||||
|
|
||||||
# Enable Checkbox to Calculate depreciation using total days in depreciation period
|
# Enable Checkbox to Calculate depreciation using total days in depreciation period
|
||||||
def test_daily_prorata_based_depr_after_enabling_configuration(self):
|
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(
|
asset = create_asset(
|
||||||
calculate_depreciation=1,
|
calculate_depreciation=1,
|
||||||
@@ -254,7 +260,9 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
|
|||||||
for d in get_depr_schedule(asset.name, "Draft")
|
for d in get_depr_schedule(asset.name, "Draft")
|
||||||
]
|
]
|
||||||
self.assertEqual(schedules, expected_schedule)
|
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
|
# Test for Written Down Value Method
|
||||||
# Frequency of deprciation = 3
|
# Frequency of deprciation = 3
|
||||||
|
|||||||
@@ -384,3 +384,4 @@ erpnext.patches.v15_0.set_difference_amount_in_asset_value_adjustment
|
|||||||
erpnext.patches.v15_0.link_purchase_item_to_asset_doc
|
erpnext.patches.v15_0.link_purchase_item_to_asset_doc
|
||||||
erpnext.patches.v15_0.migrate_to_utm_analytics
|
erpnext.patches.v15_0.migrate_to_utm_analytics
|
||||||
erpnext.patches.v14_0.update_currency_exchange_settings_for_frankfurter
|
erpnext.patches.v14_0.update_currency_exchange_settings_for_frankfurter
|
||||||
|
erpnext.patches.v15_0.update_checkbox_to_select #1
|
||||||
|
|||||||
13
erpnext/patches/v15_0/update_checkbox_to_select.py
Normal file
13
erpnext/patches/v15_0/update_checkbox_to_select.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import frappe
|
||||||
|
from frappe.utils import cint
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
if cint(frappe.db.get_single_value("Accounts Settings", "calculate_depr_using_total_days")):
|
||||||
|
frappe.db.set_single_value(
|
||||||
|
"Accounts Settings", "calculate_daily_depreciation_using", "Total days in depreciation period"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
frappe.db.set_single_value(
|
||||||
|
"Accounts Settings", "calculate_daily_depreciation_using", "Total years in depreciation period"
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user