details:   https://code.openbravo.com/erp/devel/pi/rev/13966655c3a8
changeset: 32209:13966655c3a8
user:      Mark <markmm82 <at> gmail.com>
date:      Thu May 25 13:16:54 2017 -0400
summary:   Fixes issue 36099: Price Correction Background finishes with error
if a goods receipt is invoiced after the costing migration process was run

Price Correction Background finishes with error if a goods receipt is invoiced
after the costing migration process was run. The problem is that the 
transactions
previous to the migration are generated without m_costing_algorithm_id and the
c_invoice_post function in this case, sets the transaction as 
checkpricedifference = Y.

To fix that, transactions previous to the migration will not be adjusted.
To avoid NPE in PriceDifferenceProcess.calculateTransactionPriceDifferenceLogic
was included a validation taking into account all explained above.

diffstat:

 src/org/openbravo/costing/PriceDifferenceProcess.java |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (26 lines):

diff -r 8ce08c4ce547 -r 13966655c3a8 
src/org/openbravo/costing/PriceDifferenceProcess.java
--- a/src/org/openbravo/costing/PriceDifferenceProcess.java     Fri May 26 
08:30:10 2017 +0200
+++ b/src/org/openbravo/costing/PriceDifferenceProcess.java     Thu May 25 
13:16:54 2017 -0400
@@ -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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2014-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -53,9 +53,10 @@
       MaterialTransaction materialTransaction) throws OBException {
     boolean costAdjCreated = false;
 
-    // With Standard Algorithm, no cost adjustment is needed
-    if 
(StringUtils.equals(materialTransaction.getCostingAlgorithm().getJavaClassName(),
-        "org.openbravo.costing.StandardAlgorithm")) {
+    // Without algorithm or with Standard Algorithm, no cost adjustment is 
needed
+    if (materialTransaction.getCostingAlgorithm() == null
+        || 
StringUtils.equals(materialTransaction.getCostingAlgorithm().getJavaClassName(),
+            "org.openbravo.costing.StandardAlgorithm")) {
       return false;
     }
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to