Fixes issue 22718: pending goods receipt, generate m_matchpo entry
authorMikel Irurita <mikel.irurita@openbravo.com>
Wed, 02 Jan 2013 18:30:33 +0100
changeset 19147 bf2bb9e85e41
parent 19146 42f163d092a5
child 19148 e673ef0ebd97
Fixes issue 22718: pending goods receipt, generate m_matchpo entry
src-db/database/model/functions/M_INOUT_POST.xml
--- a/src-db/database/model/functions/M_INOUT_POST.xml	Wed Jan 02 16:29:40 2013 +0100
+++ b/src-db/database/model/functions/M_INOUT_POST.xml	Wed Jan 02 18:30:33 2013 +0100
@@ -541,12 +541,7 @@
                 	-- v_Qty := Cur_SLines.QtyOrdered;
                 	--END IF;
 
-								IF (v_count <> 0) THEN                
-								  SELECT max(M_MATCHPO_ID)
-								  INTO v_MatchPO_ID
-                  FROM M_MATCHPO
-								  WHERE C_ORDERLINE_ID = Cur_SLines.C_OrderLine_ID
-								    AND M_INOUTLINE_ID = Cur_SLines.M_InOutLine_ID; 
+								IF (v_count = 0) THEN                
                   
                 	Ad_Sequence_Next('M_MatchPO', Cur_SLines.AD_Org_ID, v_MatchPO_ID) ;
                 	-- The min qty. Modified by Ismael Ciordia
@@ -568,6 +563,12 @@
                   	)
                   	;
                  ELSE
+                       SELECT max(M_MATCHPO_ID)
+                       INTO v_MatchPO_ID
+                       FROM M_MATCHPO
+                       WHERE C_ORDERLINE_ID = Cur_SLines.C_OrderLine_ID
+                            AND M_INOUTLINE_ID = Cur_SLines.M_InOutLine_ID;
+                            
                 	v_ResultStr:='UpdateMatchPO ' || v_MatchPO_ID;
                 	UPDATE M_MATCHPO
                 	SET DateTrx = now(), Qty =v_Qty, Processing = 'N', Processed = 'Y', Posted='N'