For example, for an existing field "percent_commission", we will add an attribute "readonly". Here is the format:
<field name="percent_commission" position="attributes">
<attribute name="readonly">0</attribute>
</field>
If we want to add an attribute for a specific state, here is the format like this:
<field name="percent_commission" position="attributes">
<attribute name="attrs">{'readonly':[('status','=','approved')]}</attribute>
</field>