Search code examples
productodooqwebodoo-12

Odoo how to access product.qty_available as portal user


We are trying to add the the stock of our products so it's visible to our users.

our code would just simply be:

<t t-esc="product.qty_available"/>

As a Internal User this works but a public user/portal gives a 403 error:

403: Forbidden

The page you were looking for could not be authorized.

Maybe you were looking for one of these popular pages ?

I know I should alter the access rights for users but I don't know which one to change.

Can somebody tell me what I should do to make that variable visible?

Thanks in advance!


Solution

  • You can escape the access restriction by using sudo():

    <t t-esc="product.sudo().qty_available"/> 
    

    This will change the user to SUPERUSER only for this case, without having to change the access rights for that column.