diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index bb8a641ec6d..f1107b354b3 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -725,7 +725,7 @@ class Propal extends CommonObject $result = $product->fetch($fk_product); $product_type = $product->type; - if (getDolGlobalString('STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL') && $product_type == 0 && $product->stock_reel < $qty) { + if ($product->isStockManaged() && $product->stock_reel < $qty && getDolGlobalString('STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL')) { $langs->load("errors"); $this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnProposal', $product->ref); $this->db->rollback(); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8de4c416b0a..2c31c413e7a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1673,7 +1673,7 @@ class Commande extends CommonOrder $result = $product->fetch($fk_product); $product_type = $product->type; - if (getDolGlobalString('STOCK_MUST_BE_ENOUGH_FOR_ORDER') && $product_type == 0) { + if (getDolGlobalString('STOCK_MUST_BE_ENOUGH_FOR_ORDER') && $product->isStockManaged()) { // get real stock $productChildrenNb = 0; if (getDolGlobalInt('PRODUIT_SOUSPRODUITS')) { @@ -3228,7 +3228,7 @@ class Commande extends CommonOrder $result = $product->fetch($line->fk_product); $product_type = $product->type; - if (getDolGlobalString('STOCK_MUST_BE_ENOUGH_FOR_ORDER') && $product_type == 0) { + if (getDolGlobalString('STOCK_MUST_BE_ENOUGH_FOR_ORDER') && $product->isStockManaged()) { // get real stock $productChildrenNb = 0; if (getDolGlobalInt('PRODUIT_SOUSPRODUITS')) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 28d97dd8484..928eb01835f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4282,7 +4282,7 @@ class Facture extends CommonInvoice $result = $product->fetch($fk_product); $product_type = $product->type; - if (getDolGlobalString('STOCK_MUST_BE_ENOUGH_FOR_INVOICE') && $product_type == 0) { + if (getDolGlobalString('STOCK_MUST_BE_ENOUGH_FOR_INVOICE') && $product->isStockManaged()) { // get real stock $productChildrenNb = 0; if (getDolGlobalInt('PRODUIT_SOUSPRODUITS')) { @@ -4632,7 +4632,7 @@ class Facture extends CommonInvoice $result = $product->fetch($line->fk_product); $product_type = $product->type; - if (getDolGlobalString('STOCK_MUST_BE_ENOUGH_FOR_INVOICE') && $product_type == 0) { + if (getDolGlobalString('STOCK_MUST_BE_ENOUGH_FOR_INVOICE') && $product->isStockManaged()) { // get real stock $productChildrenNb = 0; if (getDolGlobalInt('PRODUIT_SOUSPRODUITS')) {