New: Introduce hidden option

STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS to solve, with no risk, a
missing control on missing warehouse.
This commit is contained in:
Laurent Destailleur 2015-02-16 20:46:54 +01:00
parent 03d19bf77f
commit 1e78d0e8d4
6 changed files with 24 additions and 12 deletions

View File

@ -85,6 +85,8 @@ For users:
- 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 : 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 #1470, #1472, #1473] User trigger problem
- Fix: [ bug #1489, #1491 ] Intervention trigger problem

View File

@ -52,7 +52,7 @@ function commande_prepare_head($object)
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))
{
$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->livraison_bon->enabled) $text.=$langs->trans("Receivings");
$head[$h][1] = $text;

View File

@ -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 $id Id of source line
* @param int $id Id of source line (order line)
* @param int $qty Quantity
* @return int <0 if KO, >0 if OK
*/
@ -750,18 +752,26 @@ class Expedition extends CommonObject
$line->origin_line_id = $id;
$line->qty = $qty;
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) {
$orderline = new OrderLine($this->db);
$orderline->fetch($id);
$fk_product = $orderline->fk_product;
$orderline = new OrderLine($this->db);
$orderline->fetch($id);
$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);
$result=$product->fetch($fk_product);
$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->db->rollback();
return -3;

View File

@ -11,7 +11,7 @@ batch_number=Batch/Serial number
l_eatby=Eat-by date
l_sellby=Sell-by date
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
printEatby=Eat-by: %s
printSellby=Sell-by: %s

View File

@ -22,7 +22,7 @@ QtyOrdered=Qty ordered
QtyShipped=Qty shipped
QtyToShip=Qty to ship
QtyReceived=Qty received
KeepToShip=Keep to ship
KeepToShip=Remain to ship
OtherSendingsForSameOrder=Other shipments for this order
DateSending=Date sending order
DateSendingShort=Date sending order

View File

@ -122,4 +122,4 @@ RuleForStockAvailability=Rules on stock requirements
StockMustBeEnoughForInvoice=Stock level must be enough to add product/service into invoice
StockMustBeEnoughForOrder=Stock level must be enough to add product/service into order
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.