From dad780350731885bf4843df0ffc7a02a9c2af9c8 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 3 Jul 2013 21:41:54 -0500 Subject: [PATCH] IDEMPIERE-190 Average Costing: make sure amt and qty argument for the setWeightedAverage method is of the same sign --- org.adempiere.base/src/org/compiere/model/MCost.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java index 3196616968..33a4633321 100644 --- a/org.adempiere.base/src/org/compiere/model/MCost.java +++ b/org.adempiere.base/src/org/compiere/model/MCost.java @@ -1482,9 +1482,9 @@ public class MCost extends X_M_Cost public void setWeightedAverage (BigDecimal amt, BigDecimal qty) { //amount must follow the sign of qty - if (amt.signum() != 0 && amt.signum() != qty.signum()) + if (amt.signum() != 0 && qty.signum() != 0 && amt.signum() != qty.signum()) { - amt = amt.multiply(BigDecimal.valueOf(-1.00d)); + amt = amt.negate(); } if (getCurrentQty().add(qty).signum() < 0)