Allow user to view and save a field, but not edit

On the invoice form, suppose I don’t want a user to be able to change the field ‘Invoice Address’, which is populated automatically when the Party is selected.

To do that I disable write access for the field, but now, on saving the record, that field is not saved.

How can I allow the field to be viewed and saved, but not edited by a specific user?

Then you must set the value on the server side by the create and/or write methods.

Here’s what’s odd about this: if I disable write permission for the ‘Warehouse’ field in the Sale model, it still gets saved. But if I disable write permission for ‘Invoice Address’, it does not get saved. Why is this?

Because it is not the warehouse set by the client that is saved but the default warehouse value defined on the model. It just happens to be the same.
The client does not sent to the server the value of the field it knows the user has not access right.

Could you please point to an example where something similar has been done before? I’m afraid I don’t follow exactly.

I do not think Tryton relies anywhere on such design because normally if something is not editable by the user than there is no new information and we can compute it.

So I suppose you are asking to override the methods?

Edit (add): Basically I don’t want the user to be able to change the ‘Invoice Address’ which is automatically added once a party is selected. And I want it to be saved when the user saves the record.

I think the simpler is to add a validation check to ensure it is the address you want (or maybe better add a domain constraint on the address field such that only the right address can be selected).