From bb39a2cac7f714fe30e77ced870e15ec69620801 Mon Sep 17 00:00:00 2001 From: Anand Baburajan Date: Thu, 15 Jun 2023 17:12:59 +0530 Subject: [PATCH] fix: don't add GL Entry for Acc. Depr. while scrapping non-depreciable assets (#35714) fix: on asset scrap, don't add gl entry for acc. depr. if no acc. depr. --- erpnext/assets/doctype/asset/depreciation.py | 24 ++++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py index c64b917e18d..bfef57e4947 100644 --- a/erpnext/assets/doctype/asset/depreciation.py +++ b/erpnext/assets/doctype/asset/depreciation.py @@ -513,18 +513,22 @@ def get_gl_entries_on_asset_disposal( }, item=asset, ), - asset.get_gl_dict( - { - "account": accumulated_depr_account, - "debit_in_account_currency": accumulated_depr_amount, - "debit": accumulated_depr_amount, - "cost_center": depreciation_cost_center, - "posting_date": date, - }, - item=asset, - ), ] + if accumulated_depr_amount: + gl_entries.append( + asset.get_gl_dict( + { + "account": accumulated_depr_account, + "debit_in_account_currency": accumulated_depr_amount, + "debit": accumulated_depr_amount, + "cost_center": depreciation_cost_center, + "posting_date": date, + }, + item=asset, + ), + ) + profit_amount = flt(selling_amount) - flt(value_after_depreciation) if profit_amount: get_profit_gl_entries(