details:   https://code.openbravo.com/erp/devel/pi/rev/b4ee0d43b8e1
changeset: 28559:b4ee0d43b8e1
user:      Atul Gaware <atul.gaware <at> openbravo.com>
date:      Thu Jan 28 01:01:58 2016 +0530
summary:   Fixes Issue 24355:In case of processing POS Order with Immediate 
Invoice
Terms, Invoice Line is not set with  Goods Shipment Line information.

In case of POS Order get M_InOutLine_ID for OrderLine, making sure exactly
one record is retreived using Max, Qty compared to get full shipped line
reference only as there could a case where Order Line is split into two or
more based on available stock in different storage bins in that case no
reference would be set in Invoice Line.

diffstat:

 src-db/database/model/functions/C_INVOICE_CREATE.xml |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (50 lines):

diff -r 3ff3496e55f7 -r b4ee0d43b8e1 
src-db/database/model/functions/C_INVOICE_CREATE.xml
--- a/src-db/database/model/functions/C_INVOICE_CREATE.xml      Sat Jan 30 
19:07:17 2016 +0100
+++ b/src-db/database/model/functions/C_INVOICE_CREATE.xml      Thu Jan 28 
01:01:58 2016 +0530
@@ -25,7 +25,7 @@
   * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
   * All Rights Reserved.
   * Contributor(s): Openbravo SLU
-  * Contributions are Copyright (C) 2001-2015 Openbravo, S.L.U.
+  * Contributions are Copyright (C) 2001-2016 Openbravo, S.L.U.
   *
   * Specifically, this derivative work is based upon the following Compiere
   * file and version.
@@ -90,6 +90,8 @@
     v_defplantype_inv C_InvoiceLine.DefPlanType%TYPE;
     v_periodnumber_inv C_InvoiceLine.periodnumber%TYPE;
     v_period_inv C_InvoiceLine.c_period_id%TYPE;
+    v_InOutLine_ID C_InvoiceLine.M_InOutLine_ID%TYPE;
+
 
     Cur_Bpblocked RECORD;
     
@@ -582,6 +584,19 @@
                     Next_O_Line:=TRUE;
                   END IF;
                   IF(NOT Next_O_Line) THEN
+                    v_InOutLine_ID:=NULL;
+                    -- In case of POS Order get M_InOutLine_ID for OrderLine
+                    -- Making sure exactly one record is retreived using Max
+                    -- Qty compared to get full shipped line reference only
+                    -- There could a case where Order Line is split into two
+                    -- based on available stock in different storage bins
+                    -- in that no reference would be set in Invoice Line
+                    IF(v_DocSubTypeSO = 'WR') THEN
+                      SELECT MAX(sl.M_INOUTLINE_ID) INTO v_InOutLine_ID
+                        FROM M_INOUTLINE sl
+                        WHERE sl.C_ORDERLINE_ID = ptr_ol.C_OrderLine_ID
+                          AND ptr_ol.QtyOrdered = sl.MovementQty;
+                    END IF;
                     --
                     Ad_Sequence_Next('C_InvoiceLine', Cur_Order.C_Order_ID, 
v_NextNo) ;
                     v_LineNo:=v_LineNo + 10;
@@ -643,7 +658,7 @@
                       (
                         v_NextNo, ptr_ol.AD_Client_ID, ptr_ol.AD_Org_ID, 'Y',
                         now(), v_ADUserId, now(), v_ADUserId,
-                        p_Invoice_ID, ptr_ol.C_OrderLine_ID, NULL, v_LineNo,
+                        p_Invoice_ID, ptr_ol.C_OrderLine_ID, v_InOutLine_ID, 
v_LineNo,
                         ptr_ol.Description, ptr_ol.M_Product_ID, v_Qty, 
ptr_ol.PriceList,
                         ptr_ol.PriceActual, ptr_ol.PriceLimit, 
C_Currency_Round(v_Qty*ptr_ol.PriceActual, Cur_Order.C_Currency_ID, NULL), 
ptr_ol.C_Charge_ID,
                         ptr_ol.ChargeAmt, ptr_ol.C_UOM_ID,

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to