[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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user