Search code examples
pythonodooodoo-14

Access Denied by ACLs for Operation: read, uid


Error:

odoo.models: Access Denied by ACLs for operation: read, uid: 4, model: product.template, fields: activity_ids You do not have enough rights to access the fields "activity_ids" on Product Template (product.template). Please contact your system administrator."

Even when I wrote this in model.access, I still have the same issue:

mail.access_mail_activity,access.mail.activity,mail.model_mail_activity,,1,1,1,1


Solution

  • Did you somehow create an activity on the product template for a user, who has no read rights to that product template?

    Or does the user trying to access activity_ids on this specific product template not have those rights?

    The access rights of activities are bound to the access rights of the related document itself. Take a look at this

        def _filter_access_rules_remaining(self, valid, operation, filter_access_rules_method):
            """ Return the subset of ``self`` for which ``operation`` is allowed.
            A custom implementation is done on activities as this document has some
            access rules and is based on related document for activities that are
            not covered by those rules.
            Access on activities are the following :
              * create: (``mail_post_access`` or write) right on related documents;
              * read: read rights on related documents;
              * write: access rule OR
                       (``mail_post_access`` or write) rights on related documents);
              * unlink: access rule OR
                        (``mail_post_access`` or write) rights on related documents);
            """
    

    That topic is very complex, but i hope this still helps.

    Additional info: Something similar was done with attachments (ir.attachment), but it's implemented in another way.