fix(Asset Repair): Use existing function from asset.py for fetching fixed_asset_account
diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.py b/erpnext/assets/doctype/asset_repair/asset_repair.py
index 01eeb36..63cdaf5 100644
--- a/erpnext/assets/doctype/asset_repair/asset_repair.py
+++ b/erpnext/assets/doctype/asset_repair/asset_repair.py
@@ -8,6 +8,7 @@
from frappe.utils import time_diff_in_hours, getdate, add_months, flt, cint
from frappe.model.document import Document
from erpnext.accounts.general_ledger import make_gl_entries
+from erpnext.assets.doctype.asset.asset import get_asset_account
class AssetRepair(Document):
def validate(self):
@@ -100,7 +101,7 @@
def get_gl_entries(self):
gl_entry = []
repair_and_maintenance_account = frappe.db.get_value('Company', self.company, 'repair_and_maintenance_account')
- fixed_asset_account = self.get_fixed_asset_account()
+ fixed_asset_account = get_asset_account("fixed_asset_account", asset=self.asset, company=self.company)
expense_account = frappe.get_doc('Purchase Invoice', self.purchase_invoice).items[0].expense_account
gl_entry = frappe.get_doc({
@@ -132,12 +133,6 @@
})
gl_entry.insert()
- def get_fixed_asset_account(self):
- asset_category = frappe.get_doc('Asset Category', frappe.db.get_value('Asset', self.asset, 'asset_category'))
- for account in asset_category.accounts:
- if account.company_name == self.company:
- return account.fixed_asset_account
-
def modify_depreciation_schedule(self):
if self.increase_in_asset_life:
asset = frappe.get_doc('Asset', self.asset)