Hi All,
I have come across an issue where whereby if I call a function from a workflow button, it runs all of the code as the logged in user instead of a system user. The reason this is an issue is that if I am needing to search or make changes to a private module in that code it requires that the logged in user also have access to this which I don't want to give.
e.g. I have created a background module that collects information on workflow states for every other module. However if I am wanting to write / update this module for each time a user changes workflow state, it means that I need to give that user create / update permissions that module. however I don't want them to be able to access this module directly themselves and be able to view and edit records.
Therefore is there a way that when I call specific functions, they can be done with system based permission and not needing to run as the logged in user?
For example if in my workflow function, I am calling the following, it would require me giving read and create access to all users to my custom module. However I don't want to give everybody access to this module, infact it should only be accessible by the administrator or system based user.
expirydate_days = self.env['custom_module'].search([('taskmodel','=', model_id.id), ('taskstate', '=', 'approval')])
Thoughts?
Regards,
Damien