Odoo Help


Odoo 8 acess rights

on 1/1/15, 7:26 PM 1,079 views

Hello, evrybody!

I changed class product_template to show available products quantity to costumers.
new function
    def _product_template_quant(self, cr, uid, ids, name, arg, context=None):
        res = {}
        for product in self.browse(cr, uid, ids):
            if product.qty_available == 0.0:
                res[product.id] = str('Not available')
                res[product.id] = 'Available: ' + str(int(product.qty_available))
        return res
Add this function to model:
'quant': fields.function(_product_template_quant, type='char', string='Available products'),

After that i changed template
to show t-field="product.quant"

When I logged in odoo like administrator evrything go fine: i can see product quantity.
But when i`m public user (not logged on at all) i  can`t see anything.

If i change function _product_template_quant to it return constant:
    def _product_template_quant(self, cr, uid, ids, name, arg, context=None):
        res = {}
        for product in self.browse(cr, uid, ids):
            res[product.id] = 'My test const '
        return res
evrything go fine and i see 'My test const' as public user.

So, i think the problem is acess rights for field product.qty_available for public user.
I find table ir_model_access, but i can`t understand  how to give acess to product.qty_available to public user.

Can somebody give me an example how to do that?

UPDATE: here is the warning from log.
WARNING mechanic openerp.addons.base.ir.ir_model: Access Denied by ACLs for operation: read, uid: 3, model: stock.warehouse

uid:3 it is public user.


Akhil P Sivan

--Akhil P Sivan--

| 5 4 7
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 1/11/15, 8:22 AM

Denys, you can add field access control, by including a "groups" attribute in the field definition.

For eg: in the field definition of 'quant', after string='Available products', add groups="base.group_user"

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 1/1/15, 7:26 PM
Seen: 1079 times
Last updated: 3/16/15, 8:10 AM