Fixes Issue 27752:Cannot ship more than the ordered quantity when Is Quantity
authorAtul Gaware <atul.gaware@openbravo.com>
Tue, 14 Oct 2014 15:12:25 +0530
changeset 24078 9f64a8da1daa
parent 24077 ba2eb656f29e
child 24079 83c29ab40446
Fixes Issue 27752:Cannot ship more than the ordered quantity when Is Quantity
Variable checkbox is selected for the product

While processing shipment Line wise exceed check for delivered qty against
ordered qty for each order line is skipped when product flag for variable
quantity is set as Yes
src-db/database/model/functions/M_INOUT_POST.xml
--- a/src-db/database/model/functions/M_INOUT_POST.xml	Tue Oct 07 11:58:37 2014 +0530
+++ b/src-db/database/model/functions/M_INOUT_POST.xml	Tue Oct 14 15:12:25 2014 +0530
@@ -113,6 +113,8 @@
     v_qtysumorders NUMBER;
     v_released  NUMBER;
 
+    v_IsQtyVariable M_Product.IsQuantityVariable%TYPE;
+
   BEGIN
   
     IF(p_PInstance_ID IS NOT NULL) THEN
@@ -224,7 +226,7 @@
       if(v_isreturndoctype = 'N' AND v_isSoTrx = 'Y' and v_DocAction<>'RC') then
         v_message := null;
         for Cur_OrderLine in (
-          select c_orderline_id, line
+          select c_orderline_id, line, m_product_id
           from m_inoutline
           where m_inout_id = v_Record_ID
           and c_orderline_id is not null
@@ -241,13 +243,19 @@
           from c_orderline
           where c_orderline_id = Cur_OrderLine.c_orderline_id;
 
-          if(v_QuantityOrder < v_qty) then
-            if v_message is null THEN
-              v_message := Cur_OrderLine.line;
-            ELSE
-              v_message := v_message || ', ' || Cur_OrderLine.line;
-            END IF;
-          end if;
+          SELECT IsQuantityVariable INTO v_IsQtyVariable
+          FROM M_Product
+          WHERE M_Product_ID = Cur_OrderLine.M_Product_ID;
+
+          IF(v_IsQtyVariable='N') THEN
+            if(v_QuantityOrder < v_qty) then
+              if v_message is null THEN
+                v_message := Cur_OrderLine.line;
+              ELSE
+                v_message := v_message || ', ' || Cur_OrderLine.line;
+              END IF;
+            end if;
+          END IF;
         end loop;
         if v_message is not null then
           RAISE_APPLICATION_ERROR(-20000, '@MovementQtyCheck@'||' '||'@Inlines@'||' '||v_message);