diff --git a/modules/axelor-open-suite/axelor-account/src/main/java/com/axelor/apps/account/service/move/MoveLineService.java b/modules/axelor-open-suite/axelor-account/src/main/java/com/axelor/apps/account/service/move/MoveLineService.java index a6ec521..6a420c3 100644 --- a/modules/axelor-open-suite/axelor-account/src/main/java/com/axelor/apps/account/service/move/MoveLineService.java +++ b/modules/axelor-open-suite/axelor-account/src/main/java/com/axelor/apps/account/service/move/MoveLineService.java @@ -948,11 +948,26 @@ public class MoveLineService { * * @param moveLineList */ - public void reconcileMoveLinesWithCacheManagement(List moveLineList) { + public void reconcileMoveLinesWithCacheManagement(List moveLineList) throws AxelorException{ List reconciliableCreditMoveLineList = getReconciliableCreditMoveLines(moveLineList); List reconciliableDebitMoveLineList = getReconciliableDebitMoveLines(moveLineList); + + //pour desactiver le lettrage (Provisoire) + BigDecimal totalDebit = BigDecimal.ZERO; + BigDecimal totalCredit = BigDecimal.ZERO; + if (reconciliableCreditMoveLineList.size() > 0 && reconciliableDebitMoveLineList.size() > 0) { + for (MoveLine moveLine : reconciliableCreditMoveLineList) { + totalCredit = totalCredit.add(moveLine.getCredit()); + } + for (MoveLine moveLine : reconciliableDebitMoveLineList) { + totalDebit = totalDebit.add(moveLine.getDebit()); + } + } + //pour desactiver le lettrage (Provisoire) + + if(totalDebit.equals(totalCredit)){ Map, Pair, List>> moveLineMap = new HashMap<>(); populateCredit(moveLineMap, reconciliableCreditMoveLineList); @@ -973,6 +988,11 @@ public class MoveLineService { } finally { JPA.clear(); } + } + }else{ + throw new AxelorException( + TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, + "(total Credit ="+totalCredit+") != (total Debit="+totalDebit+")"); } }