diff --git a/addons/stock/wizard/stock_change_product_qty.py b/addons/stock/wizard/stock_change_product_qty.py index 1e7b19fef71..961eb2e0aef 100644 --- a/addons/stock/wizard/stock_change_product_qty.py +++ b/addons/stock/wizard/stock_change_product_qty.py @@ -98,7 +98,8 @@ class stock_change_product_qty(osv.osv_memory): 'product_id': data.product_id.id, 'location_id': data.location_id.id, 'lot_id': data.lot_id.id}, context=context) - th_qty = data.product_id.qty_available + product = data.product_id.with_context(location=data.location_id.id) + th_qty = product.qty_available line_data = { 'inventory_id': inventory_id, 'product_qty': data.new_quantity, diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index 555ced13758..aecf8d32694 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -191,7 +191,7 @@ class stock_picking(osv.osv): pick = self.browse(cr, uid, picking_id, context=context) moves = [x.id for x in pick.move_lines] move_obj= self.pool.get("stock.move") - move_obj.write(cr, uid, moves, {'invoice_state': pick.invoice_state}) + move_obj.write(cr, uid, moves, {'invoice_state': pick.invoice_state}, context=context) _columns = { 'invoice_state': fields.function(__get_invoice_state, type='selection', selection=[