[FIX] stock: can not unpack a package

Quants can only be written by the administrator.
A stock user could not use the unpack feature and was getting an access rights error.
Closes #9961
This commit is contained in:
Nicolas Piganeau
2015-12-28 15:21:47 +01:00
committed by Martin Trigaux
parent be7019ee7d
commit 9bab0aca2f
+1 -1
View File
@@ -3931,7 +3931,7 @@ class stock_package(osv.osv):
quant_obj = self.pool.get('stock.quant')
for package in self.browse(cr, uid, ids, context=context):
quant_ids = [quant.id for quant in package.quant_ids]
quant_obj.write(cr, uid, quant_ids, {'package_id': package.parent_id.id or False}, context=context)
quant_obj.write(cr, SUPERUSER_ID, quant_ids, {'package_id': package.parent_id.id or False}, context=context)
children_package_ids = [child_package.id for child_package in package.children_ids]
self.write(cr, uid, children_package_ids, {'parent_id': package.parent_id.id or False}, context=context)
#delete current package since it contains nothing anymore