From 3ba7ce115e63aa710401704516216e4f72e8a023 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Tue, 31 Aug 2010 12:09:28 +0530 Subject: [PATCH] [IMP]: stock: stock_move if state is Done raise an exception if the user is trying to modfiy the product detail bzr revid: sbh@tinyerp.com-20100831063928-l18f61er7k8eutwh --- addons/stock/stock.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 00dcec250bf..962e19a03de 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1444,6 +1444,20 @@ class stock_move(osv.osv): 'date_expected': time.strftime('%Y-%m-%d %H:%M:%S'), } + def write(self, cr, uid, ids, vals, context=None): + if not context: + 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') + 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 ' )) +# + return super(stock_move, self).write(cr, uid, ids, vals, context=context) + def copy(self, cr, uid, id, default=None, context=None): if default is None: default = {}