Skip to content
Snippets Groups Projects
Commit 1e78d0e8 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

New: Introduce hidden option

STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS to solve, with no risk, a
missing control on missing warehouse.
parent 03d19bf7
Branches
Tags
No related merge requests found
...@@ -85,6 +85,8 @@ For users: ...@@ -85,6 +85,8 @@ For users:
- New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export. - New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export.
- New : Option on extrafields to have them always editable regardless of the document status. - New : Option on extrafields to have them always editable regardless of the document status.
- New : New module PrintIPP to print without opening document is available as stable. - New : New module PrintIPP to print without opening document is available as stable.
- New : Introduce hidden option STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS to solve at no risk
a missing control on missing warehouse.
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
- Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1470, #1472, #1473] User trigger problem
- Fix: [ bug #1489, #1491 ] Intervention trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem
......
...@@ -52,7 +52,7 @@ function commande_prepare_head($object) ...@@ -52,7 +52,7 @@ function commande_prepare_head($object)
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))
{ {
$head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id;
if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipment"); if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipments");
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/'; if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings"); if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings");
$head[$h][1] = $text; $head[$h][1] = $text;
......
...@@ -732,10 +732,12 @@ class Expedition extends CommonObject ...@@ -732,10 +732,12 @@ class Expedition extends CommonObject
} }
/** /**
* Add a expedition line * Add a expedition line.
* If STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS is set, you can add a shipment line, with no stock source defined
* If STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT is not set, you can add a shipment line, even if not enough into stock
* *
* @param int $entrepot_id Id of warehouse * @param int $entrepot_id Id of warehouse
* @param int $id Id of source line * @param int $id Id of source line (order line)
* @param int $qty Quantity * @param int $qty Quantity
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
...@@ -750,18 +752,26 @@ class Expedition extends CommonObject ...@@ -750,18 +752,26 @@ class Expedition extends CommonObject
$line->origin_line_id = $id; $line->origin_line_id = $id;
$line->qty = $qty; $line->qty = $qty;
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) {
$orderline = new OrderLine($this->db); $orderline = new OrderLine($this->db);
$orderline->fetch($id); $orderline->fetch($id);
$fk_product = $orderline->fk_product; $fk_product = $orderline->fk_product;
if (! empty($orderline->fk_product)) if (! empty($orderline->fk_product))
{
if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS))
{
$this->error=$langs->trans("ErrorWarehouseRequiredIntoShipmentLine");
return -1;
}
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) // FIXME Check is done for stock of product, it must be done for stock of product into warehouse if $entrepot_id defined
{ {
$product=new Product($this->db); $product=new Product($this->db);
$result=$product->fetch($fk_product); $result=$product->fetch($fk_product);
$product_type=$product->type; $product_type=$product->type;
if($product_type == 0 && $product->stock_reel < $qty) { if ($product_type == 0 && $product->stock_reel < $qty)
{
$this->error=$langs->trans('ErrorStockIsNotEnough'); $this->error=$langs->trans('ErrorStockIsNotEnough');
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
......
...@@ -11,7 +11,7 @@ batch_number=Batch/Serial number ...@@ -11,7 +11,7 @@ batch_number=Batch/Serial number
l_eatby=Eat-by date l_eatby=Eat-by date
l_sellby=Sell-by date l_sellby=Sell-by date
DetailBatchNumber=Batch/Serial details DetailBatchNumber=Batch/Serial details
DetailBatchFormat=Batch/Serial: %s - E:%s - S: %s (Qty : %d) DetailBatchFormat=Batch/Serial: %s - Eat by: %s - Sell by: %s (Qty : %d)
printBatch=Batch: %s printBatch=Batch: %s
printEatby=Eat-by: %s printEatby=Eat-by: %s
printSellby=Sell-by: %s printSellby=Sell-by: %s
......
...@@ -22,7 +22,7 @@ QtyOrdered=Qty ordered ...@@ -22,7 +22,7 @@ QtyOrdered=Qty ordered
QtyShipped=Qty shipped QtyShipped=Qty shipped
QtyToShip=Qty to ship QtyToShip=Qty to ship
QtyReceived=Qty received QtyReceived=Qty received
KeepToShip=Keep to ship KeepToShip=Remain to ship
OtherSendingsForSameOrder=Other shipments for this order OtherSendingsForSameOrder=Other shipments for this order
DateSending=Date sending order DateSending=Date sending order
DateSendingShort=Date sending order DateSendingShort=Date sending order
......
...@@ -122,4 +122,4 @@ RuleForStockAvailability=Rules on stock requirements ...@@ -122,4 +122,4 @@ RuleForStockAvailability=Rules on stock requirements
StockMustBeEnoughForInvoice=Stock level must be enough to add product/service into invoice StockMustBeEnoughForInvoice=Stock level must be enough to add product/service into invoice
StockMustBeEnoughForOrder=Stock level must be enough to add product/service into order StockMustBeEnoughForOrder=Stock level must be enough to add product/service into order
StockMustBeEnoughForShipment= Stock level must be enough to add product/service into shipment StockMustBeEnoughForShipment= Stock level must be enough to add product/service into shipment
WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn=Source warehouse must be defined here when batch module is on. It will be used to list wich lot/serial is available for product that required lot/serial data for movement. If you want to send products from different warehouses, just make the shipment into several steps.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment