Fixes issue 29701 & Fixes issue 29861: Error in Price Correction Background
authorAlvaro Ferraz <alvaro.ferraz@openbravo.com>
Wed, 13 May 2015 12:11:18 +0200
changeset 26635 14775af5b6a0
parent 26634 5a7da4d16d1d
child 26636 59aad1232b89
Fixes issue 29701 & Fixes issue 29861: 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	Thu May 14 12:15:15 2015 +0200
+++ b/src-db/database/model/functions/C_INVOICE_POST.xml	Wed May 13 12:11:18 2015 +0200
@@ -1504,8 +1504,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	Thu May 14 12:15:15 2015 +0200
+++ b/src/org/openbravo/costing/PriceDifferenceProcess.java	Wed May 13 12:11:18 2015 +0200
@@ -205,6 +205,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);