Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2288 Zobrazení

En effet je voudrais permettre à chaque utilisateur de notre ERP de n'avoir accès qu'à ses propres contacts. Et aussi qu'il y ai un super-utilisateur qui lui verra tous...

Avatar
Zrušit
Nejlepší odpověď

Hi,

Users are only able to see their Contacts by using the Record rule:

Here the corresponding partner field refers to the user, so we can connect the user id with this field in the model. You can replace the 'related_partner' field with the res.partner field of this model.

<record id="id_record_rule_for_user" model="ir.rule">
        <field name="name">Only Own Records</field>
        <field ref="model_[your_model_name]" name="model_id"/>
        <field name="domain_force">[('related_partner_id','=',user.id)]
        </field>
        <field name="groups"
               eval="[(4, ref('module_name.user_group_name'))]"/>
    </record>



Refer to this link:

https://www.cybrosys.com/odoo/odoo-books/odoo-16-development/security/record-rules/

Regards

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
říj 23
6091
3
zář 23
2963
0
kvě 23
2940
1
dub 23
2056
2
pro 19
41492