From 186ae1c288450aca87cdc97e08930fa0d826760b Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Mon, 13 Nov 2017 16:15:12 +0100 Subject: [PATCH] [FIX] stock: update qty on hand in multi company A similar issue and a similar fix as rev 8955d15e9d92faa0e691fd432c0a644c246cf7ba Fixes #20889 --- addons/stock/wizard/stock_change_product_qty.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/stock/wizard/stock_change_product_qty.py b/addons/stock/wizard/stock_change_product_qty.py index 52345f6ef67..b29e4080e3b 100644 --- a/addons/stock/wizard/stock_change_product_qty.py +++ b/addons/stock/wizard/stock_change_product_qty.py @@ -29,7 +29,10 @@ class ProductChangeQuantity(models.TransientModel): elif not res.get('product_id') and self.env.context.get('active_id') and self.env.context.get('active_model') == 'product.product' and self.env.context.get('active_id'): res['product_id'] = self.env['product.product'].browse(self.env.context['active_id']).id if 'location_id' in fields and not res.get('location_id'): - res['location_id'] = self.env.ref('stock.stock_location_stock').id + company_user = self.env.user.company_id + warehouse = self.env['stock.warehouse'].search([('company_id', '=', company_user.id)], limit=1) + if warehouse: + res['location_id'] = warehouse.lot_stock_id.id return res @api.onchange('location_id', 'product_id')