在 openerp 中将字段在编辑模式下设置为只读,在创建模式下设置为可编辑

Make a field readonly in edit mode and editable in create mode in openerp

我想在 openerp 中使一个字段在编辑模式下只读,在创建模式下可编辑。我想要一个在创建时指定值的字段,以后不应更改它。

这是我的代码:

<field name = "apply_to_future" class="oe_edit_only"  attrs="{'readonly':[('status','=','Draft')]}" />

请帮忙。

试试这个:

attrs="{'readonly':[('apply_to_future','!=',False)]}"