Home > Enterprise >  Odoo rpc calls for unauthenticated users?
Odoo rpc calls for unauthenticated users?

Time:01-25

I am developing a template/page for Odoo where I am using an RPC call.

The problem I am having is that I want the page to be of type public, but unfortunately RPC calls are only available for authenticated users. I am trying to execute a search query, e.g:

rpc.query({
    model: modelName,
    method: 'search_read',
    args: [domain, fields]
})

CodePudding user response:

You shold write a controller auth='public' and call it with any REST Client.

Controller somthin like this:

@http.route('/my_controller', type='json', method=['GET,POST'], auth='public', csrf=False)
def my_controller(self):
    ...

You only should be careful with passing the proper cokie for Odoo.

I hope this answer can be helpful for you.

  •  Tags:  
  • Related