Fixed bug 28052: Wrong message processing a Shipment with a partial reservation.
authorUnai Martirena <unai.martirena@openbravo.com>
Fri, 02 Jan 2015 13:01:06 +0100
changeset 25712 e96a15e0c289
parent 25711 2161bdf91225
child 25713 b878d4b1ee9a
Fixed bug 28052: Wrong message processing a Shipment with a partial reservation.

Reallocation function executed when trying to complete a Goods Shipment, was changed to launch a not enough stock error if the quantity pending to release exceeds the available existent in the line's storage bin.
src-db/database/model/functions/M_RESERVATION_REALLOCATE.xml
--- a/src-db/database/model/functions/M_RESERVATION_REALLOCATE.xml	Wed Dec 31 16:16:00 2014 +0100
+++ b/src-db/database/model/functions/M_RESERVATION_REALLOCATE.xml	Fri Jan 02 13:01:06 2015 +0100
@@ -156,6 +156,10 @@
     p_message := '@MoreQuantityToReleaseThanPending@'||' @of@'||' @Product@: '||v_product_value||', @AttributeSetInstance@: '||COALESCE(v_attr_description, '-')|| ', @UOM@: '||v_uom_value||' @And@'||' @StorageBin@: '||COALESCE(v_locator_value, '-');
   END IF;
 
+  IF (v_pendingtoreallocate > v_stock_onhand) THEN
+    RAISE_APPLICATION_ERROR(-20000, '@NotEnoughAvailableStock@'||' @of@'||' @Product@: '||v_product_value||', @AttributeSetInstance@: '||COALESCE(v_attr_description, '-')|| ', @UOM@: '||v_uom_value||' @And@'||' @StorageBin@: '||COALESCE(v_locator_value, '-'));
+  END IF;
+
   -- Check that quantity to release is lower than available quantity considering other reservations allocated stock.
   IF (v_pendingtoreallocate > v_stock_onhand - (v_stock_alloc - v_this_sd_alloc)) THEN
     RAISE_APPLICATION_ERROR(-20000, '@CannotReallocateAllQuantity@'||' @of@'||' @Product@: '||v_product_value||', @AttributeSetInstance@: '||COALESCE(v_attr_description, '-')|| ', @UOM@: '||v_uom_value||' @And@'||' @StorageBin@: '||COALESCE(v_locator_value, '-'));