fix(Asset Repair): Add Company field
This commit is contained in:
parent
5ab0cabf91
commit
867fd02b2d
@ -11,6 +11,7 @@
|
||||
"naming_series",
|
||||
"column_break_2",
|
||||
"asset_name",
|
||||
"company",
|
||||
"section_break_5",
|
||||
"failure_date",
|
||||
"repair_status",
|
||||
@ -241,12 +242,19 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Purchase Invoice",
|
||||
"options": "Purchase Invoice"
|
||||
},
|
||||
{
|
||||
"fetch_from": "asset.company",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"options": "Company"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-06-16 07:52:49.438800",
|
||||
"modified": "2021-06-16 08:02:34.782990",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Assets",
|
||||
"name": "Asset Repair",
|
||||
|
@ -77,7 +77,7 @@ class AssetRepair(Document):
|
||||
stock_entry = frappe.get_doc({
|
||||
"doctype": "Stock Entry",
|
||||
"stock_entry_type": "Material Issue",
|
||||
"company": frappe.get_value('Asset', self.asset, "company")
|
||||
"company": self.company
|
||||
})
|
||||
|
||||
for stock_item in self.stock_items:
|
||||
@ -104,8 +104,7 @@ class AssetRepair(Document):
|
||||
|
||||
def get_gl_entries(self):
|
||||
gl_entry = []
|
||||
company = frappe.db.get_value('Asset', self.asset, 'company')
|
||||
repair_and_maintenance_account = frappe.db.get_value('Company', company, 'repair_and_maintenance_account')
|
||||
repair_and_maintenance_account = frappe.db.get_value('Company', self.company, 'repair_and_maintenance_account')
|
||||
fixed_asset_account = self.get_fixed_asset_account()
|
||||
expense_account = frappe.get_doc('Purchase Invoice', self.purchase_invoice).items[0].expense_account
|
||||
|
||||
@ -119,7 +118,7 @@ class AssetRepair(Document):
|
||||
"voucher_no": self.name,
|
||||
"cost_center": self.cost_center,
|
||||
"posting_date": getdate(),
|
||||
"company": company
|
||||
"company": self.company
|
||||
})
|
||||
gl_entry.insert()
|
||||
gl_entry = frappe.get_doc({
|
||||
@ -134,15 +133,14 @@ class AssetRepair(Document):
|
||||
"posting_date": getdate(),
|
||||
"against_voucher_type": "Purchase Invoice",
|
||||
"against_voucher": self.purchase_invoice,
|
||||
"company": company
|
||||
"company": self.company
|
||||
})
|
||||
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'))
|
||||
company = frappe.db.get_value('Asset', self.asset, 'company')
|
||||
for account in asset_category.accounts:
|
||||
if account.company_name == company:
|
||||
if account.company_name == self.company:
|
||||
return account.fixed_asset_account
|
||||
|
||||
def modify_depreciation_schedule(self):
|
||||
|
Loading…
Reference in New Issue
Block a user