'description': fields.text('Description', readonly=True,
states={'draft': [('readonly', False)]} ),
关于states,官方的文档的解释是:
dynamic changes to this field's
common attributes based on the state field
我的理解是:states 是基于state字段才生效的一个属性,上面代码的意思,只有state=draft 的时候,字段description:readonly=False,即可编辑的,其他情况都是只读的...