[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 b39173a8ff

closes odoo/odoo#52328

X-original-commit: 2314ce8b3de80ff6c4c9dec35ea6a201f885ba16
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
Swapnesh Shah
2020-06-03 09:57:12 +00:00
committed by GitHub
parent 014d9fcea4
commit 4b09255709
+2 -2
View File
@@ -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,