From 0e113173032aba443fc542d50b672fc30aaea750 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 15 Jun 2023 17:40:42 +0530 Subject: [PATCH] fix: don't add GL Entry for Acc. Depr. while scrapping non-depreciable assets (backport #35714) (#35716) * 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. (cherry picked from commit bb39a2cac7f714fe30e77ced870e15ec69620801) # Conflicts: # erpnext/assets/doctype/asset/depreciation.py * chore: fix conflict --------- Co-authored-by: Anand Baburajan --- erpnext/assets/doctype/asset/depreciation.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py index 4f79ae847ca..d086f180d3a 100644 --- a/erpnext/assets/doctype/asset/depreciation.py +++ b/erpnext/assets/doctype/asset/depreciation.py @@ -466,15 +466,19 @@ def get_gl_entries_on_asset_disposal(asset, selling_amount=0, finance_book=None, "cost_center": depreciation_cost_center, "posting_date": date, }, - { - "account": accumulated_depr_account, - "debit_in_account_currency": accumulated_depr_amount, - "debit": accumulated_depr_amount, - "cost_center": depreciation_cost_center, - "posting_date": date, - }, ] + if accumulated_depr_amount: + gl_entries.append( + { + "account": accumulated_depr_account, + "debit_in_account_currency": accumulated_depr_amount, + "debit": accumulated_depr_amount, + "cost_center": depreciation_cost_center, + "posting_date": date, + }, + ) + profit_amount = flt(selling_amount) - flt(value_after_depreciation) if profit_amount: get_profit_gl_entries(