fix: Asset cancelation issue

(cherry picked from commit fa2b6c4490)
This commit is contained in:
Khushi Rawat
2024-05-14 17:56:06 +05:30
committed by Mergify
parent 53ea9ff102
commit e18be9b21e

View File

@@ -450,11 +450,12 @@ class JournalEntry(AccountsController):
def unlink_asset_reference(self): def unlink_asset_reference(self):
for d in self.get("accounts"): for d in self.get("accounts"):
root_type = frappe.get_value("Account", d.account, "root_type")
if ( if (
self.voucher_type == "Depreciation Entry" self.voucher_type == "Depreciation Entry"
and d.reference_type == "Asset" and d.reference_type == "Asset"
and d.reference_name and d.reference_name
and d.account_type == "Depreciation" and root_type == "Expense"
and d.debit and d.debit
): ):
asset = frappe.get_doc("Asset", d.reference_name) asset = frappe.get_doc("Asset", d.reference_name)