Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd

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?

Avatar
Annuleer
Auteur Beste antwoord

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.

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
nov. 19
3335
1
sep. 23
3750
1
mrt. 23
2372
3
jan. 23
6140
2
jan. 23
951