Q:

How to set a field readonly in openerp and change value witn on_change method

I have set readonly option to 1 for sequence field than when  I try to change value from on_change method the value is droped after I click on save button.
This is my code:  
<record id="view_attachment_form_inherit" model="ir.ui.view">
        <field name="name">ir.attachment.inherit</field>
        <field name="model">ir.attachment</field>
        <field name="inherit_id" ref="base.view_attachment_form"/>
        <field name="arch" type="xml">
            <field name='name' position="after">
                <field name='sequence' readonly='1'/>
                <group>
                    <field name='number' on_change='number_change(number)'/>
                </group>
            </field>
        </field>
    </record>

Python code:  
def number_change(self, cr, uid, ids, number, context=None):
    # do test for this number
    return {'value': {'sequence': 'new sequence'} }

How can I change to save it ?

A:

readonly fields are not sent back to the back end by the web client (because since they are readonly, they won't change). 
workaround is to hide the 'sequence' field, and remove the readonly="1" attribute. 
If you still want to see the value of the sequence, add a dummy field "sequence_ro" in your model, which you can display with readonly='1', and update in the onchange method. 

