Search in sources :

Example 56 with Move

use of com.axelor.apps.account.db.Move in project axelor-open-suite by axelor.

the class MoveController method isHiddenMoveLineListViewer.

public void isHiddenMoveLineListViewer(ActionRequest request, ActionResponse response) {
    Move move = request.getContext().asType(Move.class);
    boolean isHidden = true;
    try {
        if (move.getMoveLineList() != null && move.getStatusSelect() < MoveRepository.STATUS_VALIDATED) {
            for (MoveLine moveLine : move.getMoveLineList()) {
                if (moveLine.getAmountPaid().compareTo(BigDecimal.ZERO) > 0 || moveLine.getReconcileGroup() != null) {
                    isHidden = false;
                }
            }
        }
        response.setAttr("$reconcileTags", "hidden", isHidden);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Move(com.axelor.apps.account.db.Move) MoveLine(com.axelor.apps.account.db.MoveLine) AxelorException(com.axelor.exception.AxelorException)

Example 57 with Move

use of com.axelor.apps.account.db.Move in project axelor-open-suite by axelor.

the class MoveController method computeTotals.

public void computeTotals(ActionRequest request, ActionResponse response) {
    Move move = request.getContext().asType(Move.class);
    try {
        Map<String, Object> values = Beans.get(MoveService.class).computeTotals(move);
        response.setValues(values);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : MoveService(com.axelor.apps.account.service.move.MoveService) ExtractContextMoveService(com.axelor.apps.account.service.extract.ExtractContextMoveService) Move(com.axelor.apps.account.db.Move) AxelorException(com.axelor.exception.AxelorException)

Example 58 with Move

use of com.axelor.apps.account.db.Move in project axelor-open-suite by axelor.

the class MoveController method updateInDayBookMode.

public void updateInDayBookMode(ActionRequest request, ActionResponse response) {
    Move move = request.getContext().asType(Move.class);
    move = Beans.get(MoveRepository.class).find(move.getId());
    try {
        if (move.getStatusSelect() == MoveRepository.STATUS_ACCOUNTED) {
            Beans.get(MoveService.class).getMoveValidateService().updateInDayBookMode(move);
            response.setReload(true);
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Move(com.axelor.apps.account.db.Move) AxelorException(com.axelor.exception.AxelorException)

Example 59 with Move

use of com.axelor.apps.account.db.Move in project axelor-open-suite by axelor.

the class MoveController method generateReverse.

public void generateReverse(ActionRequest request, ActionResponse response) {
    try {
        Context context = request.getContext();
        Move move = context.asType(Move.class);
        move = Beans.get(MoveRepository.class).find(move.getId());
        Map<String, Object> assistantMap = Beans.get(ExtractContextMoveService.class).getMapFromMoveWizardGenerateReverseForm(context);
        Move newMove = Beans.get(MoveService.class).generateReverse(move, assistantMap);
        if (newMove != null) {
            response.setView(ActionView.define(I18n.get("Account move")).model("com.axelor.apps.account.db.Move").add("grid", "move-grid").add("form", "move-form").param("forceEdit", "true").context("_showRecord", newMove.getId().toString()).map());
            response.setCanClose(true);
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Context(com.axelor.rpc.Context) MoveService(com.axelor.apps.account.service.move.MoveService) ExtractContextMoveService(com.axelor.apps.account.service.extract.ExtractContextMoveService) Move(com.axelor.apps.account.db.Move) ExtractContextMoveService(com.axelor.apps.account.service.extract.ExtractContextMoveService) AxelorException(com.axelor.exception.AxelorException)

Example 60 with Move

use of com.axelor.apps.account.db.Move in project axelor-open-suite by axelor.

the class MoveController method validate.

public void validate(ActionRequest request, ActionResponse response) {
    Move move = request.getContext().asType(Move.class);
    move = Beans.get(MoveRepository.class).find(move.getId());
    try {
        Beans.get(MoveService.class).getMoveValidateService().validate(move);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e, ResponseMessageType.ERROR);
    }
}
Also used : Move(com.axelor.apps.account.db.Move) AxelorException(com.axelor.exception.AxelorException)

Aggregations

Move (com.axelor.apps.account.db.Move)101 MoveLine (com.axelor.apps.account.db.MoveLine)51 Transactional (com.google.inject.persist.Transactional)37 Company (com.axelor.apps.base.db.Company)36 AxelorException (com.axelor.exception.AxelorException)34 BigDecimal (java.math.BigDecimal)33 Partner (com.axelor.apps.base.db.Partner)31 LocalDate (java.time.LocalDate)28 Journal (com.axelor.apps.account.db.Journal)25 Account (com.axelor.apps.account.db.Account)22 ArrayList (java.util.ArrayList)22 AccountConfig (com.axelor.apps.account.db.AccountConfig)18 Reconcile (com.axelor.apps.account.db.Reconcile)14 AnalyticMoveLine (com.axelor.apps.account.db.AnalyticMoveLine)11 Invoice (com.axelor.apps.account.db.Invoice)11 List (java.util.List)7 BankDetails (com.axelor.apps.base.db.BankDetails)6 InvoicePayment (com.axelor.apps.account.db.InvoicePayment)5 MoveRepository (com.axelor.apps.account.db.repo.MoveRepository)5 MoveService (com.axelor.apps.account.service.move.MoveService)5