[FIX] stock: edit quant without company id

Some quant can have no company_id (quant for partner locations).
But when user edit a quant, the stock move `company_id` is based on the
quant's one. As the `company_id` is required for a stock move, we force
to take the `company_id` of the user in case the quant don't have one.

Task #2035465
This commit is contained in:
svs-odoo
2019-07-26 12:22:34 +00:00
parent 70f99448d5
commit b39173a8ff
+2 -2
View File
@@ -538,7 +538,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,
'company_id': self.company_id.id or self.env.user.company_id.id,
'state': 'confirmed',
'location_id': location_id.id,
'location_dest_id': location_dest_id.id,
@@ -548,7 +548,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,
'company_id': self.company_id.id or self.env.user.company_id.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,