It is not possible to make a field read-only by setReadOnly when the field is dot-walked.
This issue is reproducible when the reference field value is set by the same client script making the dot-walked field read-only.
1. Go to sys_user table and fill out the value of city for Abel Tuter's record
2. Go to incident table and add "caller_id.city" field on the form
3. Create a new onload Client Script with script code as below (sys_id is the Abel Tuter's sys_user record)
4. Go to incident > Create new
Observe the "City" field is not read-only.
In Client Script, do not call g_form.setValue(dot_walk_parent_field) & g_form.setReadOnly(dot_walk_children_field) back to back. Either use a setTimeout() function to delay few milliseconds between the two calls or create a UI Policy do setReadOnly on dot_walk_children_field.