style: code optimization

(cherry picked from commit e843683ad1)
This commit is contained in:
Khushi Rawat
2024-05-14 20:03:58 +05:30
committed by Mergify
parent e18be9b21e
commit ccda17ede2

View File

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