Hi I have created following API function:
@frappe.whitelist()
def create_downtime(asset_id):
try:
workstation = frappe.get_value("Asset", asset_id, "workstation")
factory = frappe.get_value('Workstation', workstation, 'factory')
factory_head = frappe.get_value('Factory', factory, 'factory_head')
downtime = frappe.new_doc("Downtime Log")
downtime.created_date = nowdate()
downtime.assigned_to = factory_head
downtime.asset_name = asset_id
downtime.start_date_time = now()
downtime.status = "Open"
downtime.insert(ignore_permissions=True)
return downtime
except Exception as e:
frappe.log_error(frappe.get_traceback(), "Create Downtime Error")
return {
"status": "error",
"message": str(e)
}
When I invoke this function using Postman I get following response:
{
"data": {
"name": "DT-24-10-0009",
"owner": "api@indusworks.in",
"creation": "2024-10-24 14:23:59.068547",
"modified": "2024-10-24 14:23:59.068547",
"modified_by": "api@indusworks.in",
"docstatus": 0,
"idx": 0,
"created_date": "2024-10-24",
"assigned_to": "navneet@indusworks.in",
"asset_name": "asset1",
"start_date_time": "2024-10-24 14:23:59.068455",
"duration": 0.005921,
"status": "Open",
"iteration_count": 1,
"workstation_name": "Test Workstation 1",
"doctype": "Downtime Log"
}
}
However the record is not visible on desk.
When I run it again I get the same record with same name but it does not show up desk.
the code runs on my local machine/site but not on the site hosted on frappe cloud.
What can be the problems?