Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ

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?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 11 19
3395
1
thg 9 23
3787
1
thg 3 23
2419
3
thg 1 23
6197
2
thg 1 23
951