Odoo Help

Welcome!

This community 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.

0

How to make price field read only in point of sale for specific user?

By
Sohail
on 6/1/13, 12:29 PM 1,092 views

How to prevent some specific users from making changes in price of product in point of sale? Every user is not allowed to change product price.

2
Khalid
On 6/1/13, 5:00 PM

Hi,

try this, post here if you find any other easy solution :

function field called permissions. group called fellow add those users into this group to whom you want field price as readonly.

    def _check_permissions(self, cr, uid, ids, field_name, arg, context):
    res = {}
    formid = ids[0]
    group_obj = self.pool.get('res.groups')
        group_ids = group_obj.search(cr, uid, [('name','=', 'Fellow')])
    group_obj = group_obj.browse(cr, uid, group_ids)
    group_users = len(fellow[0].users)
    i = 0
    while i < group_users : 
        if group_obj[0].users[i].id == uid : 
            res[formid] = True
        i = i + 1
    return res


'permissions': fields.function(_check_permissions, type='char', method=True, string="Permissions"),
'price': fields.float('Price'),


<field name="permissions" invisible="1"/>
<field name="price" attrs="{'readonly':[('permissions','=',True)]}"/>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 6/1/13, 12:29 PM
Seen: 1092 times
Last updated: 3/16/15, 8:10 AM