fix(Asset Repair): Use existing function from asset.py for fetching fixed_asset_account
This commit is contained in:
		
							parent
							
								
									94ac52c47d
								
							
						
					
					
						commit
						c61bbc5915
					
				| @ -8,6 +8,7 @@ from frappe import _ | ||||
| from frappe.utils import time_diff_in_hours, getdate, nowdate, 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): | ||||
| @ -99,7 +100,7 @@ class AssetRepair(Document): | ||||
| 	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({ | ||||
| @ -131,12 +132,6 @@ class AssetRepair(Document): | ||||
| 		}) | ||||
| 		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) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user