python - How to make a field editable only after saving the record in ODOO -


i have field in odoo. want non-editable during creation of record. after saving record, if again edit , should editable

you can readonly attribute base on id field:

<field name='id' invisible='true'/> <field name="field_name" attrs="{'readonly': [('id','=', false )]}"/> 

demo:

<record model="ir.ui.view" id="session_form_view">     <field name="name">session.form</field>     <field name="model">openacademy.session</field>     <field name="arch" type="xml">         <form string="session form">            <field name='id' invisible='true'/>            <field name="name" attrs="{'readonly': [('id','=', false )]}"/>         </form>     </field> </record> 

id default field in odoo , takes value after creation of record name field should not editable during creation of record.


Comments