use of com.axelor.apps.account.service.move.MoveValidateService in project axelor-open-suite by axelor.
the class PaymentScheduleLineBankPaymentServiceImpl method createRejectionMove.
@Transactional(rollbackOn = { Exception.class })
protected Move createRejectionMove(PaymentScheduleLine paymentScheduleLine) throws AxelorException {
MoveValidateService moveValidateService = moveService.getMoveValidateService();
MoveLineService moveLineService = moveService.getMoveLineService();
Move advanceOrPaymentMove = paymentScheduleLine.getAdvanceOrPaymentMove();
Move rejectionMove = moveService.generateReverse(advanceOrPaymentMove, true, true, false, advanceOrPaymentMove.getDate());
rejectionMove.setRejectOk(true);
moveValidateService.validate(rejectionMove);
List<MoveLine> moveLineList = new ArrayList<>();
moveLineList.addAll(advanceOrPaymentMove.getMoveLineList());
moveLineList.addAll(rejectionMove.getMoveLineList());
moveLineService.reconcileMoveLines(moveLineList);
return rejectionMove;
}
Aggregations