fix: Asset status after maintenance or repair
Fix a bug where an **Asset**'s status is not being set to what it was previously after an **Asset Repair** or **Asset Maintenance**.
This commit is contained in:
parent
c9ebef4d30
commit
7a86a77322
@ -561,14 +561,18 @@ class Asset(AccountsController):
|
|||||||
return 100 * (1 - flt(depreciation_rate, float_precision))
|
return 100 * (1 - flt(depreciation_rate, float_precision))
|
||||||
|
|
||||||
def update_maintenance_status():
|
def update_maintenance_status():
|
||||||
assets = frappe.get_all('Asset', filters = {'docstatus': 1, 'maintenance_required': 1})
|
assets = frappe.get_all(
|
||||||
|
"Asset", filters={"docstatus": 1, "maintenance_required": 1}
|
||||||
|
)
|
||||||
|
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
asset = frappe.get_doc("Asset", asset.name)
|
asset = frappe.get_doc("Asset", asset.name)
|
||||||
if frappe.db.exists('Asset Maintenance Task', {'parent': asset.name, 'next_due_date': today()}):
|
if frappe.db.exists("Asset Repair", {"asset_name": asset.name, "repair_status": "Pending"}):
|
||||||
asset.set_status('In Maintenance')
|
asset.set_status("Out of Order")
|
||||||
if frappe.db.exists('Asset Repair', {'asset_name': asset.name, 'repair_status': 'Pending'}):
|
elif frappe.db.exists("Asset Maintenance Task", {"parent": asset.name, "next_due_date": today()}):
|
||||||
asset.set_status('Out of Order')
|
asset.set_status("In Maintenance")
|
||||||
|
else:
|
||||||
|
asset.set_status()
|
||||||
|
|
||||||
def make_post_gl_entry():
|
def make_post_gl_entry():
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user