Try ERPNext Buy Support Partners Foundation

Unable to save Shift Type via API when updating last_sync_of_checkin

Erpnext version: v12.8.0

When last_sync_of_checkin of Shift Type is updated via API the document goes into “Not saved” status. The values do get updated. Sample code using frappe-client - https://github.com/frappe/frappe-client

doc = conn.get_doc('Shift Type', 'all-day')
doc['working_hours_threshold_for_absent'] = 3
doc['last_sync_of_checkin'] = '2020-05-19 20:08:10.285412'
conn.update(doc)

Trying to save it by setting “docstatus” in another PUT request fails with permission error. I have tried using the frappe-client - https://github.com/frappe/frappe-client - and that runs into a “Not permitted” “You do not have enough permissions to complete the action” when trying to submit. The same user is able to save from the UI. The following is the code

doc = conn.get_doc('Shift Type', 'all-day')
doc['docstatus'] = 1
conn.update(doc)

If last_sync_of_checkin is not among the fields updated, the document is saved.

This same problem - of document going into “not saved” status is seen when adding new employee checkins via API also.

This was due to microseconds in the timestamp.