Fixes issue 29890 & Fixes issue 29888: Error in Price Correction Background
authorAlvaro Ferraz <alvaro.ferraz@openbravo.com>
Thu, 14 May 2015 17:23:03 +0200
changeset 26680 29047546bcdb
parent 26679 6cbc78180ba8
child 26681 5932bc301a29
Fixes issue 29890 & Fixes issue 29888: Error in Price Correction Background

IsCostCalculated will not be considered to set CheckPriceDifference flag, when completing an invoice.
Instead, when running Price Correction Background, transactions will be filtered by IsCostCalculated to avoid calculate price differences in transactions where cost has not been calculated.
src-db/database/model/functions/C_INVOICE_POST.xml
src/org/openbravo/costing/PriceDifferenceProcess.java
--- a/src-db/database/model/functions/C_INVOICE_POST.xml	Fri May 15 12:01:31 2015 +0200
+++ b/src-db/database/model/functions/C_INVOICE_POST.xml	Thu May 14 17:23:03 2015 +0200
@@ -22,7 +22,7 @@
   * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
   * All Rights Reserved.
   * Contributor(s): Openbravo SLU
-  * Contributions are Copyright (C) 2001-2014 Openbravo, S.L.U.
+  * Contributions are Copyright (C) 2001-2015 Openbravo, S.L.U.
   *
   * Specifically, this derivative work is based upon the following Compiere
   * file and version.
@@ -1503,8 +1503,7 @@
         FROM C_INVOICELINE IL 
           JOIN M_MATCHINV MI ON IL.C_INVOICELINE_ID = MI.C_INVOICELINE_ID
           JOIN M_TRANSACTION TRX ON MI.M_INOUTLINE_ID = TRX.M_INOUTLINE_ID
-        WHERE TRX.ISCOSTCALCULATED = 'Y' 
-        AND IL.C_INVOICE_ID = v_record_id);
+        WHERE IL.C_INVOICE_ID = v_record_id);
 
         v_ResultStr:='MatchInv-PO';
         FOR Cur_ILines_PO IN
--- a/src/org/openbravo/costing/PriceDifferenceProcess.java	Fri May 15 12:01:31 2015 +0200
+++ b/src/org/openbravo/costing/PriceDifferenceProcess.java	Thu May 14 17:23:03 2015 +0200
@@ -11,7 +11,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) 2014 Openbravo SLU
+ * All portions are Copyright (C) 2014-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -202,6 +202,7 @@
       mTrxs.add(Restrictions.eq(MaterialTransaction.PROPERTY_PRODUCT, product));
     }
     mTrxs.add(Restrictions.eq(MaterialTransaction.PROPERTY_CHECKPRICEDIFFERENCE, true));
+    mTrxs.add(Restrictions.eq(MaterialTransaction.PROPERTY_ISCOSTCALCULATED, true));
     mTrxs.addOrderBy(MaterialTransaction.PROPERTY_MOVEMENTDATE, true);
     mTrxs.addOrderBy(MaterialTransaction.PROPERTY_TRANSACTIONPROCESSDATE, true);
     ScrollableResults lines = mTrxs.scroll(ScrollMode.FORWARD_ONLY);