我正在尝试在 Openerp 中学习编码,并决定开始自定义简单的“想法”模块。我刚刚尝试在模型中添加一个新的文本字段,如下所示(在' * '之间):
class idea_idea(osv.osv):
""" Idea """
_name = 'idea.idea'
_inherit = ['mail.thread']
_columns = {
'create_uid': fields.many2one('res.users', 'Creator', required=True, readonly=True),
'name': fields.char('Idea Summary', size=64, required=True, readonly=True, oldname='title', states={'draft': [('readonly', False)]}),
'description': fields.text('Description', help='Content of the idea', readonly=True, states={'draft': [('readonly', False)]}),
'category_ids': fields.many2many('idea.category', string='Tags', readonly=True, states={'draft': [('readonly', False)]}),
***'mother_id': fields.text('Testing mother id'), #fields.many2one('idea.idea'),***
'state': fields.selection([('draft', 'New'),
('open', 'Accepted'),
('cancel', 'Refused'),
('close', 'Done')],
'Status', readonly=True, track_visibility='onchange',
)
}
...
在idea_view.xml 中添加了一个标签和一个字段,就像'description':
...<sheet>
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
<label for="category_ids" class="oe_edit_only"/>
<field name="category_ids" widget="many2many_tags"/>
<label for="description"/><newline/>
<field name="description"/>
***<label for="mother_id"/><newline/>
<field name="mother_id"/>***
</sheet>
...
但是当我尝试升级模块时,它返回错误:ValidateError
验证字段拱时发生错误:视图架构的 XML 无效!
我究竟做错了什么?我最初想创建一个引用“母亲想法”的 many2one 字段,但没有设法获得一个简单的文本字段:P