我有两个模型技能和用户。在
我希望每个用户可以有许多技能,而且每个技能可以有许多用户在它上面。我试过那样做,但没有成功。在
这是我的技能:
class technicians_skills(osv.osv):
_name = 'skills'
_description = 'Technicians Skills'
_columns = {
'name': fields.char(string='name', size=50),
'description': fields.text(string="description"),
'member_ids': fields.many2many('res.users', 'skill', string='Technicians')
}
这是用户:
^{pr2}$我想知道每个用户的技能,但当我称之为:
test = http.request.env['skills.rel'].search([])
它显示了这个错误
KeyError: 'skills.rel'
您需要指定声明中的所有关键字才能创建相同的关系表
而在另一个定义中,保持关系的名称相同,但与另一个关键字相反。在
在技能上
^{pr2}$在用户中
你看我是如何颠倒定义的,只是关系是一样的。 保持列的名称相同
编辑:
不要对关系执行搜索,因为它们不是模型。您需要对模型执行搜索,然后访问多个字段。在
假设你想获得当前用户的技能。在
如果你想获得多个用户的技能。在
相关问题 更多 >
编程相关推荐