我正在尝试在Openerp中学习编码,并决定开始定制简单的“Ideas”模块。我刚刚尝试在模型中添加一个新的文本字段,如下所示(在' * '之间):
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
验证字段arch时出错:View Architecture的XML无效!
我做错了什么?我本来想创建一个涉及“母亲想法”的many2one字段,但是没有设法得到一个简单的文本字段:P
答案 0 :(得分:0)
解决了问题:我卸载了模块,重新启动了服务器并重新安装了模块。