Hi all,
I need to prevent a group from changing unit price on sale order.
I have found this code, but I really do not know where to put it. On the code, "Fellow" is the group name and "permissions" is a function field.
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 + i
return res
and
'permissions': fields.function(_check_permissions, type='char', method=True, string="Permissions"),
'price': fields.float('price'),
and also this code
<field name="permissions" invisible="1"/>
<field name="price" attrs="{'readonly':[('permissions','=',True)]}"/>
Can you please help me on where to put each piece of code?
Paulo