Search in sources :

Example 1 with SubrogationRelease

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

the class SubrogationReleaseController method printToPDF.

public void printToPDF(ActionRequest request, ActionResponse response) {
    try {
        SubrogationRelease subrogationRelease = request.getContext().asType(SubrogationRelease.class);
        String name = String.format("%s %s", I18n.get("Subrogation release"), subrogationRelease.getSequenceNumber());
        String fileLink = Beans.get(SubrogationReleaseService.class).printToPDF(subrogationRelease, name);
        response.setView(ActionView.define(name).add("html", fileLink).map());
        response.setReload(true);
    } catch (Exception e) {
        response.setError(e.getMessage());
        TraceBackService.trace(e);
    }
}
Also used : SubrogationRelease(com.axelor.apps.account.db.SubrogationRelease) SubrogationReleaseService(com.axelor.apps.account.service.SubrogationReleaseService)

Example 2 with SubrogationRelease

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

the class SubrogationReleaseController method displayMoveLines.

public void displayMoveLines(ActionRequest request, ActionResponse response) {
    try {
        SubrogationRelease subrogationRelease = request.getContext().asType(SubrogationRelease.class);
        List<Long> moveLineIdList = new ArrayList<Long>();
        for (Move move : subrogationRelease.getMoveList()) {
            for (MoveLine moveLine : move.getMoveLineList()) {
                moveLineIdList.add(moveLine.getId());
            }
        }
        response.setView(ActionView.define("MoveLines").model(MoveLine.class.getName()).add("grid", "move-line-grid").add("form", "move-line-form").param("search-filters", "move-line-filters").domain("self.id in (" + Joiner.on(",").join(moveLineIdList) + ")").map());
    } catch (Exception e) {
        response.setError(e.getMessage());
        TraceBackService.trace(e);
    }
}
Also used : Move(com.axelor.apps.account.db.Move) SubrogationRelease(com.axelor.apps.account.db.SubrogationRelease) ArrayList(java.util.ArrayList) MoveLine(com.axelor.apps.account.db.MoveLine)

Example 3 with SubrogationRelease

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

the class SubrogationReleaseController method enterReleaseInTheAccounts.

public void enterReleaseInTheAccounts(ActionRequest request, ActionResponse response) {
    try {
        SubrogationRelease subrogationRelease = request.getContext().asType(SubrogationRelease.class);
        subrogationRelease = Beans.get(SubrogationReleaseRepository.class).find(subrogationRelease.getId());
        Beans.get(SubrogationReleaseService.class).enterReleaseInTheAccounts(subrogationRelease);
        response.setReload(true);
    } catch (Exception e) {
        response.setError(e.getMessage());
        TraceBackService.trace(e);
    }
}
Also used : SubrogationRelease(com.axelor.apps.account.db.SubrogationRelease) SubrogationReleaseService(com.axelor.apps.account.service.SubrogationReleaseService)

Example 4 with SubrogationRelease

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

the class SubrogationReleaseController method transmitRelease.

public void transmitRelease(ActionRequest request, ActionResponse response) {
    try {
        SubrogationRelease subrogationRelease = request.getContext().asType(SubrogationRelease.class);
        subrogationRelease = Beans.get(SubrogationReleaseRepository.class).find(subrogationRelease.getId());
        Beans.get(SubrogationReleaseService.class).transmitRelease(subrogationRelease);
        response.setReload(true);
    } catch (Exception e) {
        response.setError(e.getMessage());
        TraceBackService.trace(e);
    }
}
Also used : SubrogationRelease(com.axelor.apps.account.db.SubrogationRelease) SubrogationReleaseService(com.axelor.apps.account.service.SubrogationReleaseService)

Example 5 with SubrogationRelease

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

the class SubrogationReleaseController method retrieveInvoices.

public void retrieveInvoices(ActionRequest request, ActionResponse response) {
    try {
        SubrogationRelease subrogationRelease = request.getContext().asType(SubrogationRelease.class);
        Company company = subrogationRelease.getCompany();
        List<Invoice> invoiceList = Beans.get(SubrogationReleaseService.class).retrieveInvoices(company);
        response.setValue("invoiceSet", invoiceList);
    } catch (Exception e) {
        response.setError(e.getMessage());
        TraceBackService.trace(e);
    }
}
Also used : Company(com.axelor.apps.base.db.Company) Invoice(com.axelor.apps.account.db.Invoice) SubrogationRelease(com.axelor.apps.account.db.SubrogationRelease) SubrogationReleaseService(com.axelor.apps.account.service.SubrogationReleaseService)

Aggregations

SubrogationRelease (com.axelor.apps.account.db.SubrogationRelease)11 SubrogationReleaseService (com.axelor.apps.account.service.SubrogationReleaseService)5 Invoice (com.axelor.apps.account.db.Invoice)4 Move (com.axelor.apps.account.db.Move)3 MoveLine (com.axelor.apps.account.db.MoveLine)3 Company (com.axelor.apps.base.db.Company)3 Account (com.axelor.apps.account.db.Account)2 AccountConfig (com.axelor.apps.account.db.AccountConfig)2 Journal (com.axelor.apps.account.db.Journal)2 Transactional (com.google.inject.persist.Transactional)2 BigDecimal (java.math.BigDecimal)2 ReportFactory (com.axelor.apps.ReportFactory)1 Notification (com.axelor.apps.account.db.Notification)1 InvoiceRepository (com.axelor.apps.account.db.repo.InvoiceRepository)1 MoveRepository (com.axelor.apps.account.db.repo.MoveRepository)1 SubrogationReleaseRepository (com.axelor.apps.account.db.repo.SubrogationReleaseRepository)1 IExceptionMessage (com.axelor.apps.account.exception.IExceptionMessage)1 IReport (com.axelor.apps.account.report.IReport)1 AccountConfigService (com.axelor.apps.account.service.config.AccountConfigService)1 InvoiceToolService (com.axelor.apps.account.service.invoice.InvoiceToolService)1