Hi,
I tried to use axelor’s REST API but when I tried to do an update, nothing is updated, for example:
I want to update Vehicle line :
1 – I am calling : http://localhost:8080/axelor-erp/ws/rest/com.axelor.apps.fleet.db.Vehicle/32
2 – I set the field I want to change in JSON like : { "data": { "color": "test" } }
I don’t receive any error, but, Axelor returns the dictionnary with 0 update (the same dictionnary); I tried to set the whole dictionnary, (with all field) it works once, but when I try to change anything after this, axelor returns :
The record has been updated or deleted by another transaction: [Vehicle {id: 32}]
Any help, I tried to search in forum but I found nothing.
In addition to the field id, you need to send the version field. version field is available for all objects and used to check that the row has not been updated since the last time it was retrieved when updating the persistent object.
That’s why you have the The record has been updated or deleted by another transaction: [Vehicle {id: 32}] message when you update the record for the second time : version is now oldValue + 1.
Through web services, when you update a record, the response contains the updated values. You should see the version with the new value.