[REF] stock :Improve the code

bzr revid: sbh@tinyerp.com-20100831064449-ue17q1iud1g1l4g0
This commit is contained in:
sbh (Open ERP) 2010-08-31 12:14:49 +05:30
parent 3ba7ce115e
commit fdac7f3692
1 changed files with 4 additions and 3 deletions

View File

@ -1449,12 +1449,13 @@ class stock_move(osv.osv):
context={}
group_id = self.pool.get('res.groups').search(cr, uid, [('name', 'in', ('Administration / Configuration','Administration / Access Rights'))])
user_obj = self.pool.get('res.users')
group=[]
user_rec = user_obj.read(cr, uid, uid)
for move in self.browse(cr, uid, ids):
if move.state=='done':
for i in group_id:
if i not in user_rec['groups_id']:
raise osv.except_osv(_('Error!'), _('Quantities, UoMs, Products and Locations cannot be modified on stock moves in Done state (except by the Administrator ' ))
group=[i for i in group_id if (i and (i not in user_rec['groups_id']))]
if group:
raise osv.except_osv(_('Error!'), _('Quantities, UoMs, Products and Locations cannot be modified on stock moves in Done state (except by the Administrator ' ))
#
return super(stock_move, self).write(cr, uid, ids, vals, context=context)