[Python] How to restrict access to a record based on one2many field access

Discussão em 'Python' iniciado por Stack, Setembro 24, 2024.

  1. Stack

    Stack Membro Participativo

    In odoo 16, I have a request model that has a one2many line_ids field.

    I want to restrict access to the request record if the user has no access on at least one line. How to do that?

    Let's say the access to the line is determined by a boolean field: line rule:

    [('has_access', '=', True)]

    I tried this domain in a request record rule:

    [('line_ids.has_access', '=' , True)]

    but the user was still allowed to open the request (even if some lines were hidden). I tried a computed field that uses check_access_rule('read') but also with no help.

    In short: I want to prevent the user from access a 'request' record if there is at least on line the doesn't have access to. Please help and thank you.

    Continue reading...

Compartilhe esta Página