Search in sources :

Example 1 with MoveValidateService

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;
}
Also used : MoveLineService(com.axelor.apps.account.service.move.MoveLineService) MoveValidateService(com.axelor.apps.account.service.move.MoveValidateService) Move(com.axelor.apps.account.db.Move) MoveLine(com.axelor.apps.account.db.MoveLine) ArrayList(java.util.ArrayList) Transactional(com.google.inject.persist.Transactional)

Aggregations

Move (com.axelor.apps.account.db.Move)1 MoveLine (com.axelor.apps.account.db.MoveLine)1 MoveLineService (com.axelor.apps.account.service.move.MoveLineService)1 MoveValidateService (com.axelor.apps.account.service.move.MoveValidateService)1 Transactional (com.google.inject.persist.Transactional)1 ArrayList (java.util.ArrayList)1