Is there a way to update a document using the Rest API but avoid tracking the changes (adding entries in the activity log)?
I was able to accomplish using the link posted above as well as creating a server script of type API. I was then able to call the new API, make my change but avoid having it add the activity entry.
For background, I’m using the API to import data from our old ERP system into ERPNext. I was hitting road blocks if the customer/vendor/item happened to be disabled but I was trying to import a sales order, invoice, etc. The API would fail (understandably) if something was disabled. I wanted a way I could quickly re-enable that object, create the document, and then disable it but not have the disabled object’s history fill up with all these changes.
For anyone else who may be looking for this, my server script ended up being the following:
docType = frappe.form_dict.docType
name = frappe.form_dict.name
disabled = frappe.form_dict.disabled
fieldName = frappe.form_dict.fieldName
try:
doc = frappe.get_last_doc( docType, filters={ "Name": name }, order_by="creation desc" )
doc.db_set( fieldName, disabled, update_modified=False )
frappe.response['message'] = "OK"
except frappe.DoesNotExistError:
frappe.response['message'] = "Document does not exist"
frappe.response['http_status_code'] = 400