\n";
+
/* Disabled. Would be better to be managed with a user cookie
if (isModEnabled('productbatch')) {
print '
';
diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang
index c436d911ed69b..19f68a8518212 100644
--- a/htdocs/langs/en_US/stocks.lang
+++ b/htdocs/langs/en_US/stocks.lang
@@ -337,3 +337,6 @@ LatestModifiedWarehouses=Latest %s modified warehouses
LatestStockMovements=Latest %s stock movements
QtyCurrentlyKnownInStock=System estimated quantity you have in stock. As long as the inventory is not closed, this is a realtime value and it may change if you continue to make stock movement during the inventory (not recommended).
QtyInStockWhenInventoryWasValidated=System estimated quantity you had in stock when the inventory was validated (before the stock correction)
+ActivateWarehouseUsage=Activate the option that products in a warehouse do not count towards the stock (e.g., quarantine warehouse)
+WarehouseUsageCount=included in stock
+WarehouseUsageNoCount=excluded from stock
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 8fa39941e4ffa..e76333aa0acec 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -5877,6 +5877,9 @@ public function load_stock($option = '', $includedraftpoforvirtual = null, $date
if (count($warehouseStatus)) {
$sql .= " AND w.statut IN (".$this->db->sanitize(implode(',', $warehouseStatus)).")";
}
+ if (getDolGlobalString('STOCK_USE_WAREHOUSE_USAGE')) {
+ $sql .= " AND w.warehouse_usage = 1";
+ }
$sql .= " ORDER BY ps.reel ".(getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE') ? 'DESC' : 'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation;
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 7e2f9fb290356..324c4038186a4 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -213,6 +213,7 @@
$object->country_id = GETPOST("country_id");
$object->phone = GETPOST("phone");
$object->fax = GETPOST("fax");
+ $object->warehouse_usage = GETPOST("warehouse_usage");
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
@@ -966,6 +967,22 @@
print '