From fdac7f3692fda55cc65db2576bf02131c67b2bc1 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Tue, 31 Aug 2010 12:14:49 +0530 Subject: [PATCH] [REF] stock :Improve the code bzr revid: sbh@tinyerp.com-20100831064449-ue17q1iud1g1l4g0 --- addons/stock/stock.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 962e19a03de..eea37ec5ee2 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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)