跳至内容
菜单
此问题已终结

Hi mates,

I'm trying to create a custom res.config.settings but I need more insights, let me explain my case. I want to save in my custom config settings, 2 type of users (users that belongs to "maintenance" group users nor "reviewers" group users)

class ResConfigSettings(models.TransientModel):
    _inherit='res.config.settings'
    type_1_user_ids = fields.One2many('res.users', ... domain=lambda self:[('groups_id','=',self.env.ref('mygroup'))])
    type2_user_ids = fields.One2many ...

The thing is that,  I cannot declare the field of the inverse Many2one field in comodel_name because Many2One relationships from non-transient Model (res.users) to TransientModel (res.config.settings) are forbidden.

How can I achieve this?

形象
丢弃
编写者 最佳答案

FYI, i solved this by using many2many fields instead of one2many. The only thing you have to keep in mind is to use different relational database tables for both m2m fields.

形象
丢弃
相关帖文 回复 查看 活动
2
11月 19
3340
1
9月 23
3759
1
3月 23
2378
3
1月 23
6146
2
1月 23
951