diff --git a/base/src/org/compiere/model/MDistribution.java b/base/src/org/compiere/model/MDistribution.java index 807b47d9ef..0d2dc7a164 100644 --- a/base/src/org/compiere/model/MDistribution.java +++ b/base/src/org/compiere/model/MDistribution.java @@ -41,7 +41,6 @@ public class MDistribution extends X_GL_Distribution */ private static final long serialVersionUID = -906547096682610205L; - /** * Get Distribution for combination * @param acct account (ValidCombination) @@ -157,7 +156,7 @@ public class MDistribution extends X_GL_Distribution MDistribution[] retValue = (MDistribution[])s_accounts.get(key); if (retValue != null) return retValue; - final String whereClause = I_GL_Distribution.COLUMNNAME_Account_ID; + final String whereClause = "Account_ID=?"; List list = new Query(ctx,I_GL_Distribution.Table_Name,whereClause+"=?",null) .setParameters(Account_ID) @@ -243,22 +242,22 @@ public class MDistribution extends X_GL_Distribution .list(); //red1 Query -end- boolean hasNullRemainder = false; - for (MDistributionLine dl:list){ + for (MDistributionLine dl : list) { if (dl.isActive()) - { - PercentTotal = PercentTotal.add(dl.getPercent()); - hasNullRemainder = Env.ZERO.compareTo(dl.getPercent()) == 0; - } - dl.setParent(this); - // Update Ratio when saved and difference - if (hasNullRemainder) - PercentTotal = Env.ONEHUNDRED; - if (get_ID() != 0 && PercentTotal.compareTo(getPercentTotal()) != 0) - { - setPercentTotal(PercentTotal); - save(); - } + { + PercentTotal = PercentTotal.add(dl.getPercent()); + hasNullRemainder = Env.ZERO.compareTo(dl.getPercent()) == 0; } + dl.setParent(this); + } + // Update Ratio when saved and difference + if (hasNullRemainder) + PercentTotal = Env.ONEHUNDRED; + if (get_ID() != 0 && PercentTotal.compareTo(getPercentTotal()) != 0) + { + setPercentTotal(PercentTotal); + save(); + } // return m_lines = new MDistributionLine[list.size ()]; list.toArray (m_lines); diff --git a/extend/src/test/functional/MDistributionListTest.java b/extend/src/test/functional/MDistributionTest.java similarity index 94% rename from extend/src/test/functional/MDistributionListTest.java rename to extend/src/test/functional/MDistributionTest.java index 07152bfdf0..0e4fa1137f 100644 --- a/extend/src/test/functional/MDistributionListTest.java +++ b/extend/src/test/functional/MDistributionTest.java @@ -22,7 +22,7 @@ import test.AdempiereTestCase; /** * @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest */ -public class MDistributionListTest extends AdempiereTestCase +public class MDistributionTest extends AdempiereTestCase { @Override protected void setUp() throws Exception