Fixes Issue 28092:"create invoices from orders" form should consider order
authorAtul Gaware <atul.gaware@openbravo.com>
Thu, 20 Nov 2014 17:27:26 +0530
changeset 25574 0310a892cf74
parent 25573 8dd8af8a26e5
child 25575 ec460f26664c
Fixes Issue 28092:"create invoices from orders" form should consider order
lines partially delivered, when "customer schedule after delivery"

In case of invoice rule as Customer Schedule After Delivery in Order,
Create Invoice From Orders considers Orders Partially Delivered
and not yet invoiced.
src/org/openbravo/erpCommon/ad_forms/GenerateInvoicesmanual_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/GenerateInvoicesmanual_data.xsql	Thu Dec 18 13:29:41 2014 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/GenerateInvoicesmanual_data.xsql	Thu Nov 20 17:27:26 2014 +0530
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -39,7 +39,7 @@
       AND dt.isreturn='N'
       AND l.value = ic.term
       AND ord.C_ORDER_ID=ic.C_ORDER_ID
-      AND ((ic.term = 'D' AND ic.qtydelivered <>0) OR (ic.term = 'I' AND exists (SELECT 1 FROM C_ORDERLINE ol WHERE ol.C_ORDER_ID = ord.C_ORDER_ID AND ol.QTYORDERED-ol.QTYINVOICED <> 0)) OR (ic.term <> 'N' AND (ic.term IN ('O','S') AND (ic.qtyordered = ic.qtydelivered) )) )
+      AND ((ic.term ='D' AND ic.qtydelivered <>0) OR (ic.term = 'I' AND exists (SELECT 1 FROM C_ORDERLINE ol WHERE ol.C_ORDER_ID = ord.C_ORDER_ID AND ol.QTYORDERED-ol.QTYINVOICED <> 0)) OR (ic.term <> 'N' AND (ic.term IN ('O') AND (ic.qtyordered = ic.qtydelivered) )) OR (ic.term = 'S' AND exists (SELECT 1 FROM C_ORDERLINE ol WHERE ol.C_ORDER_ID = ord.C_ORDER_ID AND ol.QTYDELIVERED <> 0 AND ol.QTYDELIVERED <> ol.QTYINVOICED)))
       AND AD_Reference_ID='150'
       AND ic.ad_client_id in ('1')
       AND ic.ad_org_id in ('1')
@@ -72,7 +72,7 @@
       AND dt.isReturn='N'
       AND l.value = ic.term
       AND ord.C_ORDER_ID=ic.C_ORDER_ID
-      AND ((ic.term = 'D' AND ic.qtydelivered <>0) OR (ic.term = 'I' AND exists (SELECT 1 FROM C_ORDERLINE ol WHERE ol.C_ORDER_ID = ord.C_ORDER_ID AND ol.QTYORDERED-ol.QTYINVOICED <> 0)) OR (ic.term <> 'N' AND (ic.term IN ('O','S') AND (ic.qtyordered = ic.qtydelivered) )) )
+      AND ((ic.term ='D' AND ic.qtydelivered <>0) OR (ic.term = 'I' AND exists (SELECT 1 FROM C_ORDERLINE ol WHERE ol.C_ORDER_ID = ord.C_ORDER_ID AND ol.QTYORDERED-ol.QTYINVOICED <> 0)) OR (ic.term <> 'N' AND (ic.term IN ('O') AND (ic.qtyordered = ic.qtydelivered) )) OR (ic.term = 'S' AND exists (SELECT 1 FROM C_ORDERLINE ol WHERE ol.C_ORDER_ID = ord.C_ORDER_ID AND ol.QTYDELIVERED <> 0 AND ol.QTYDELIVERED <> ol.QTYINVOICED)))
       AND AD_Reference_ID='150'
       AND ic.ad_client_id in ('1')
       AND ic.ad_org_id in ('1')