From e830cca88617dfd5d2622116a7bf44c4beb8c753 Mon Sep 17 00:00:00 2001 From: SowmyaArunachalam Date: Tue, 25 Nov 2025 22:28:26 +0530 Subject: [PATCH] feat(asset): make asset depreciation failure notification role configurable --- .../doctype/accounts_settings/accounts_settings.json | 10 +++++++++- .../doctype/accounts_settings/accounts_settings.py | 1 + erpnext/assets/doctype/asset/depreciation.py | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index 64b8b27cd76..a21e45b0729 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -73,6 +73,7 @@ "calculate_depr_using_total_days", "column_break_gjcc", "book_asset_depreciation_entry_automatically", + "role_used_for_depreciation_failure", "closing_settings_tab", "period_closing_settings_section", "acc_frozen_upto", @@ -658,6 +659,13 @@ "fieldname": "use_legacy_controller_for_pcv", "fieldtype": "Check", "label": "Use Legacy Controller For Period Closing Voucher" + }, + { + "description": "Users with this role will be notified if the asset depreciation gets failed", + "fieldname": "role_used_for_depreciation_failure", + "fieldtype": "Link", + "label": "Role used for Depreciation Failure", + "options": "Role" } ], "grid_page_length": 50, @@ -666,7 +674,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2025-10-20 14:06:08.870427", + "modified": "2025-11-24 23:36:21.829372", "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings", diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py index bef862d85e0..3024d01cdcf 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py @@ -65,6 +65,7 @@ class AccountsSettings(Document): reconciliation_queue_size: DF.Int role_allowed_to_over_bill: DF.Link | None role_to_override_stop_action: DF.Link | None + role_used_for_depreciation_failure: DF.Link | None round_row_wise_tax: DF.Check show_balance_in_coa: DF.Check show_inclusive_tax_in_print: DF.Check diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py index 25148dc0a18..fb46ec70c02 100644 --- a/erpnext/assets/doctype/asset/depreciation.py +++ b/erpnext/assets/doctype/asset/depreciation.py @@ -307,7 +307,8 @@ def set_depr_entry_posting_status_for_failed_assets(failed_asset_names): def notify_depr_entry_posting_error(failed_asset_names, error_log_names): - recipients = get_users_with_role("Accounts Manager") + user_role = frappe.db.get_single_value("Accounts Settings", "role_used_for_depreciation_failure") + recipients = get_users_with_role(user_role or "Accounts Manager") if not recipients: recipients = get_users_with_role("System Manager")