diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 9acc4232490..a45d82e12b0 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -302,6 +302,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);