This question has been flagged
5 Replies
7082 Views

Scenario: 

I have added the following variable on the product website to show the available stock for that product: <h1 t-field="product.virtual_available"></h1> 

It is working fine while I'm logged as administrator. However it is not showing anymore when I logged as a customer (restricted profile).

Does someone have any idea how can I fix this?

 

Thank you in advance. 

Avatar
Discard

zbik, I already did this, and it is showing fine what I'm needing. The problem I'm still facing is when log in with a restricted profile, as a customer for example. When I'm loging in as administrator it is working, the problem is when I'm not loged as admin.

Best Answer

You customize Template ID: website_sale.product and insert tag like this:

<span t-field="product.qty_available"/>

 

Avatar
Discard
Best Answer

Genius Genius Genius! Thank you very much! My Odoo 11 installation give me Internal Error 500 when I was trying to use qty_available on Portal. I use your "<h1 t-field="product.sudo().virtual_available"></h1>" and help me a lot! Thanks Again! :D

Avatar
Discard

Hello,

If you are in V11, you should not add a field from v8 !

So just remove your line, and enable the feature website_sale_stock that will do it for you automatically without any customization ;)

PS: this field still exist in actual code, so you probably make another issue.

Could you provide the complete traceback?

Thanks

Best Answer

Hi Joseph,

It's a security issue ! Public User (Default user for website) don't have the right to read this field ! 

So if you want really show it, you can change rights, or simply browse with more rights the record in QWEB view...


Eg. replacing : 

<h1 t-field="product.virtual_available"></h1>

by 

<h1 t-field="product.sudo().virtual_available"></h1>

 


Avatar
Discard
Best Answer

Hello Jose Andres,


I am relatively new to Odoo, could you help me in getting this working for my Odoo website/shop?

I assume I need to have the Website Shop ready, I need some consumable products, and I guess that I also need the Warehouse module, correct?

Then how do I make the shop listed products to show the available stock within their description?.


Many thanks.

Avatar
Discard