Fixed bug 24010 Generate receipt from invoices fails
authorSandra Huguet <sandra.huguet@openbravo.com>
Fri, 07 Jun 2013 12:31:18 +0200
changeset 20514 962bd86db4f3
parent 20513 72a6ddafde71
child 20515 d6594f0d34ff
Fixed bug 24010 Generate receipt from invoices fails
src-db/database/model/functions/M_INOUT_CREATE.xml
--- a/src-db/database/model/functions/M_INOUT_CREATE.xml	Tue Jun 11 15:59:34 2013 +0530
+++ b/src-db/database/model/functions/M_INOUT_CREATE.xml	Fri Jun 07 12:31:18 2013 +0200
@@ -894,10 +894,10 @@
             Cur_Lines.QuantityOrder, Cur_Lines.M_Product_Uom_ID, Cur_Lines.M_ATTRIBUTESETINSTANCE_ID,
             coalesce(Cur_Lines.C_Project_ID, Cur_Invoice.C_Project_ID), coalesce(Cur_Lines.A_Asset_ID, Cur_Invoice.A_Asset_ID), 
             coalesce(Cur_Lines.C_CostCenter_ID, Cur_Invoice.C_CostCenter_ID), coalesce(Cur_Lines.User1_ID, Cur_Invoice.User1_ID),
-            coalesce(Cur_Lines.User2_ID, Cur_Invoice.User2_ID), ol.explode, (select m_inoutline_id 
-                                     from m_inoutline 
-                                     where m_inout_id = p_InOut_ID
-                                       and c_orderline_id = (SELECT BOM_parent_id from c_orderline WHERE c_orderline_id = ol.C_OrderLine_ID)));
+            coalesce(Cur_Lines.User2_ID, Cur_Invoice.User2_ID), Cur_Lines.explode, (select m_inoutline_id 
+                                     from c_invoiceline
+                                     where c_invoice_id = Cur_Lines.C_Invoice_ID
+                                       and c_invoiceline_id = Cur_Lines.BOM_parent_id));
           UPDATE C_INVOICELINE
           SET M_INOUTLINE_ID=v_NextNo,
               Updated=now(),