Skip to content
Permalink
Browse files

[FIX] stock: inventory on category

- 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 27f8bb8913d71850395c15d7958b926020792afb
Showing with 1 addition and 1 deletion.
  1. +1 −1 addons/stock/models/stock_inventory.py
@@ -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

0 comments on commit 27f8bb8

Please sign in to comment.
You can’t perform that action at this time.