[FIX] stock: update qty on hand in multi company
A similar issue and a similar fix as rev 8955d15e9d
Fixes #20889
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user