From 34bb2946986ba6d75ac9b40cce18353fe966bd3d Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 11 Oct 2013 16:25:32 +0200 Subject: [PATCH] [FIX] stock: use SUPERUSER_ID to create/copy quants bzr revid: qdp-launchpad@openerp.com-20131011142532-uyvyqueucaucjsnx --- addons/stock/stock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 1e1e2132f5e..9888092f708 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -304,7 +304,7 @@ class stock_quant(osv.osv): negative_vals['cost'] = price_unit negative_vals['negative_dest_location_id'] = move.location_dest_id.id negative_vals['package_id'] = package_id - negative_quant_id = self.create(cr, uid, negative_vals, context=context) + negative_quant_id = self.create(cr, SUPERUSER_ID, negative_vals, context=context) vals.update({'propagated_from_id': negative_quant_id}) #create the quant as superuser, because we want to restrict the creation of quant manually: they should always use this method to create quants @@ -315,7 +315,7 @@ class stock_quant(osv.osv): context = context or {} if (quant.qty > 0 and quant.qty <= qty) or (quant.qty <= 0 and quant.qty >= qty): return False - new_quant = self.copy(cr, uid, quant.id, default={'qty': quant.qty - qty}, context=context) + new_quant = self.copy(cr, SUPERUSER_ID, quant.id, default={'qty': quant.qty - qty}, context=context) self.write(cr, uid, quant.id, {'qty': qty}, context=context) quant.refresh() return self.browse(cr, uid, new_quant, context=context)