Skip to content

Commit

Permalink
[FIX] stock: inventory on category
Browse files Browse the repository at this point in the history
- Create a product category A
- Create a product category A1
- Add a product in A1
- Launch an inventory adjustment on A, and select 'Exhausted Products'

All products (even from other categories) are included.

Since there is no product found in the category `products_to_filter`
and `quant_products` are empty. Therefore, we fall back on
`[('id', 'not in', [])]`, which selects everything.

The root cause is that we don't include child categories. There is no
real point of doing so.

opw-1932192

closes #31322
  • Loading branch information
nim-odoo committed Feb 21, 2019
1 parent b2db72c commit 27f8bb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/stock/models/stock_inventory.py
Expand Up @@ -267,7 +267,7 @@ def _get_inventory_lines_values(self):
args += (self.package_id.id,)
#case 5: Filter on One product category + Exahausted Products
if self.category_id:
categ_products = Product.search([('categ_id', '=', self.category_id.id)])
categ_products = Product.search([('categ_id', 'child_of', self.category_id.id)])
domain += ' AND product_id = ANY (%s)'
args += (categ_products.ids,)
products_to_filter |= categ_products
Expand Down

0 comments on commit 27f8bb8

Please sign in to comment.