From 4b0925570980292e08dff074e39fc5478ef0314f Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Tue, 2 Jun 2020 18:15:09 +0000 Subject: [PATCH] [FIX] stock: correct company Before this commit, `self.env.user.company_id.id` may represents different company from the current company based on context. In this commit, we use correct company based on contextual company. Follow up on b39173a8ffc4ef5dd5524e027a9f0ad746b07bd8 closes odoo/odoo#52328 X-original-commit: 2314ce8b3de80ff6c4c9dec35ea6a201f885ba16 Signed-off-by: Simon Lejeune (sle) --- addons/stock/models/stock_quant.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index 0ffc3d245cf..10ce708554b 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -574,7 +574,7 @@ class StockQuant(models.Model): 'product_id': self.product_id.id, 'product_uom': self.product_uom_id.id, 'product_uom_qty': qty, - 'company_id': self.company_id.id or self.env.user.company_id.id, + 'company_id': self.company_id.id or self.env.company.id, 'state': 'confirmed', 'location_id': location_id.id, 'location_dest_id': location_dest_id.id, @@ -584,7 +584,7 @@ class StockQuant(models.Model): 'qty_done': qty, 'location_id': location_id.id, 'location_dest_id': location_dest_id.id, - 'company_id': self.company_id.id or self.env.user.company_id.id, + 'company_id': self.company_id.id or self.env.company.id, 'lot_id': self.lot_id.id, 'package_id': out and self.package_id.id or False, 'result_package_id': (not out) and self.package_id.id or False,