Odoo中文网|Odoo实施培训

标题: OpenERP states含义注解 [打印本页]

作者: 郎中    时间: 2015-9-9 23:03
标题: OpenERP states含义注解
初步接触Odoo,记录一下自己学习到的一些点.
在看代码的时候,看到这样的一句code:
'state': fields.selection([('draft','Draft'),
('confirmed','Confirmed')],'State',required=True,readonly=True),

'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,即可编辑的,其他情况都是只读的...






欢迎光临 Odoo中文网|Odoo实施培训 (http://www.chinaodoo.net/) Powered by Discuz! X3.2