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