desactiver le lettrage Provisoire = MoveLine

This commit is contained in:
walid seghier
2023-04-09 18:02:40 +01:00
parent 96787c0529
commit cd115a234b

View File

@@ -948,11 +948,26 @@ public class MoveLineService {
*
* @param moveLineList
*/
public void reconcileMoveLinesWithCacheManagement(List<MoveLine> moveLineList) {
public void reconcileMoveLinesWithCacheManagement(List<MoveLine> moveLineList) throws AxelorException{
List<MoveLine> reconciliableCreditMoveLineList = getReconciliableCreditMoveLines(moveLineList);
List<MoveLine> 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<List<Object>, Pair<List<MoveLine>, List<MoveLine>>> 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+")");
}
}