From b8f630e59f9cc21390e15e1b06f0189b5716b503 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 1 Sep 2015 16:18:10 +0200 Subject: [PATCH] [FIX] stock_account: context could be None In the use case of a mrp repair ending, the context when calling `_store_average_cost_price` is None opw-648254 --- addons/stock_account/stock_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index 2b12106af38..63c4a542e16 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -285,7 +285,7 @@ class stock_move(osv.osv): average_valuation_price += q.qty * q.cost average_valuation_price = average_valuation_price / move.product_qty # Write the standard price, as SUPERUSER_ID because a warehouse manager may not have the right to write on products - ctx = dict(context, force_company=move.company_id.id) + ctx = dict(context or {}, force_company=move.company_id.id) product_obj.write(cr, SUPERUSER_ID, [move.product_id.id], {'standard_price': average_valuation_price}, context=ctx) self.write(cr, uid, [move.id], {'price_unit': average_valuation_price}, context=context)