From cde29c29eb8633a0e4d02ed00588d755c0ca1cee Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Tue, 22 Aug 2017 14:10:43 +0200 Subject: [PATCH] [FIX] stock: compute location on quant package The field 'location_id' on quant package is not computed anymore, as all quants of a package are in the same location we take the location of the first quant --- addons/stock/models/stock_quant.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index 5e99ebc841e..582d24d1033 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -267,6 +267,8 @@ class QuantPackage(models.Model): def _compute_package_info(self): for package in self: values = {'location_id': False, 'company_id': self.env.user.company_id.id, 'owner_id': False} + if self.quant_ids: + values['location_id'] = self.quant_ids[0].location_id package.location_id = values['location_id'] package.company_id = values['company_id'] package.owner_id = values['owner_id']