diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 509c4b93131..c1689d81989 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -309,6 +309,13 @@ class Inventory extends CommonObject $sql .= " AND cp.fk_categorie IN (".$this->db->sanitize($this->categories_product).")"; $sql .= ")"; } + if (getDolGlobalInt('PRODUIT_SOUSPRODUITS')) { + $sql .= " AND NOT EXISTS ("; + $sql .= " SELECT pa.rowid"; + $sql .= " FROM ".$this->db->prefix()."product_association as pa"; + $sql .= " WHERE pa.fk_product_pere = ps.fk_product"; + $sql .= ")"; + } $inventoryline = new InventoryLine($this->db);