diff --git a/addons/stock_landed_costs/stock_landed_costs.py b/addons/stock_landed_costs/stock_landed_costs.py
index 8933cec11649ed11669e168276fd8ad62d0b7370..ad729377fb2268b0bb3bcb574b6436b256d198f3 100644
--- a/addons/stock_landed_costs/stock_landed_costs.py
+++ b/addons/stock_landed_costs/stock_landed_costs.py
@@ -204,7 +204,7 @@ class stock_landed_cost(osv.osv):
                     else:
                         quant_dict[quant.id] += diff
                 for key, value in quant_dict.items():
-                    quant_obj.write(cr, uid, quant.id, {'cost': value}, context=context)
+                    quant_obj.write(cr, uid, key, {'cost': value}, context=context)
                 qty_out = 0
                 for quant in line.move_id.quant_ids:
                     if quant.location_id.usage != 'internal':