From 4c816a10549524dcc6b3e473490c23c44912eba3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sat, 16 Dec 2017 11:17:36 +0530 Subject: [PATCH] Patch to set calculate_depreciation if schedule already exists (#12061) --- erpnext/patches.txt | 3 ++- .../patches/v10_0/update_asset_calculate_depreciation.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v10_0/update_asset_calculate_depreciation.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 144a53e2de..2b6452d0c6 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -482,4 +482,5 @@ erpnext.patches.v10_0.add_non_profit_domain erpnext.patches.v10_0.setup_vat_for_uae_and_saudi_arabia erpnext.patches.v10_0.set_primary_contact_for_customer erpnext.patches.v10_0.copy_projects_renamed_fields -erpnext.patches.v10_0.enabled_regional_print_format_based_on_country \ No newline at end of file +erpnext.patches.v10_0.enabled_regional_print_format_based_on_country +erpnext.patches.v10_0.update_asset_calculate_depreciation diff --git a/erpnext/patches/v10_0/update_asset_calculate_depreciation.py b/erpnext/patches/v10_0/update_asset_calculate_depreciation.py new file mode 100644 index 0000000000..72d7ef610a --- /dev/null +++ b/erpnext/patches/v10_0/update_asset_calculate_depreciation.py @@ -0,0 +1,8 @@ +import frappe + +def execute(): + frappe.db.sql(""" + update tabAsset a + set calculate_depreciation = 1 + where exists(select ds.name from `tabDepreciation Schedule` ds where ds.parent=a.name) + """) \ No newline at end of file