mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
Merge pull request #66 from acsone/8.0-fix_stock_available-lga
[FIX] stock_available : use extend instead of append
This commit is contained in:
@@ -36,16 +36,16 @@ class ProductTemplate(models.Model):
|
||||
stock_location_obj = self.env['stock.location']
|
||||
internal_locations = stock_location_obj.search([
|
||||
('usage', '=', 'internal')])
|
||||
sublocation_ids = []
|
||||
sublocations = self.env['stock.location']
|
||||
for location in internal_locations:
|
||||
sublocation_ids.append(self.env['stock.location'].search(
|
||||
[('id', 'child_of', location.id)]).ids)
|
||||
sublocations += stock_location_obj.search(
|
||||
[('id', 'child_of', location.id)])
|
||||
for product_template in self:
|
||||
products = self.env['product.product'].search([
|
||||
('product_tmpl_id', '=', product_template.id)])
|
||||
quant_obj = self.env['stock.quant']
|
||||
quants = quant_obj.search([
|
||||
('location_id', 'in', sublocation_ids),
|
||||
('location_id', 'in', sublocations.ids),
|
||||
('product_id', 'in', products.ids),
|
||||
('reservation_id', '=', False)])
|
||||
availability = 0
|
||||
|
||||
Reference in New Issue
Block a user