[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
This commit is contained in:
Denis Ledoux 2015-09-01 16:18:10 +02:00
parent fdd08a8b4b
commit b8f630e59f
1 changed files with 1 additions and 1 deletions

View File

@ -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)