use of com.axelor.exception.service.TraceBackService in project axelor-open-suite by axelor.
the class StockMoveController method plan.
public void plan(ActionRequest request, ActionResponse response) {
try {
StockMove stockMove = request.getContext().asType(StockMove.class);
// we have to inject TraceBackService to use non static methods
TraceBackService traceBackService = Beans.get(TraceBackService.class);
long tracebackCount = traceBackService.countMessageTraceBack(stockMove);
Beans.get(StockMoveService.class).plan(Beans.get(StockMoveRepository.class).find(stockMove.getId()));
response.setReload(true);
if (traceBackService.countMessageTraceBack(stockMove) > tracebackCount) {
traceBackService.findLastMessageTraceBack(stockMove).ifPresent(traceback -> response.setNotify(String.format(I18n.get(com.axelor.apps.message.exception.IExceptionMessage.SEND_EMAIL_EXCEPTION), traceback.getMessage())));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.exception.service.TraceBackService in project axelor-open-suite by axelor.
the class ManufOrderController method partialFinish.
public void partialFinish(ActionRequest request, ActionResponse response) {
try {
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
// we have to inject TraceBackService to use non static methods
TraceBackService traceBackService = Beans.get(TraceBackService.class);
long tracebackCount = traceBackService.countMessageTraceBack(manufOrder);
if (!Beans.get(ManufOrderWorkflowService.class).partialFinish(manufOrder)) {
response.setNotify(I18n.get(IExceptionMessage.MANUF_ORDER_EMAIL_NOT_SENT));
} else if (traceBackService.countMessageTraceBack(manufOrder) > tracebackCount) {
traceBackService.findLastMessageTraceBack(manufOrder).ifPresent(traceback -> response.setNotify(String.format(I18n.get(com.axelor.apps.message.exception.IExceptionMessage.SEND_EMAIL_EXCEPTION), traceback.getMessage())));
}
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.exception.service.TraceBackService in project axelor-open-suite by axelor.
the class InvoiceController method validateAndVentilate.
/**
* Called by the validate button, if the ventilation is skipped in invoice config
*
* @param request
* @param response
*/
public void validateAndVentilate(ActionRequest request, ActionResponse response) {
Invoice invoice = request.getContext().asType(Invoice.class);
invoice = Beans.get(InvoiceRepository.class).find(invoice.getId());
try {
// we have to inject TraceBackService to use non static methods
TraceBackService traceBackService = Beans.get(TraceBackService.class);
long tracebackCount = traceBackService.countMessageTraceBack(invoice);
Beans.get(InvoiceService.class).validateAndVentilate(invoice);
response.setReload(true);
if (traceBackService.countMessageTraceBack(invoice) > tracebackCount) {
traceBackService.findLastMessageTraceBack(invoice).ifPresent(traceback -> response.setNotify(String.format(I18n.get(com.axelor.apps.message.exception.IExceptionMessage.SEND_EMAIL_EXCEPTION), traceback.getMessage())));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.exception.service.TraceBackService in project axelor-open-suite by axelor.
the class InvoiceController method validate.
/**
* Fonction appeler par le bouton valider
*
* @param request
* @param response
* @return
*/
public void validate(ActionRequest request, ActionResponse response) throws AxelorException {
Invoice invoice = request.getContext().asType(Invoice.class);
invoice = Beans.get(InvoiceRepository.class).find(invoice.getId());
try {
// we have to inject TraceBackService to use non static methods
TraceBackService traceBackService = Beans.get(TraceBackService.class);
long tracebackCount = traceBackService.countMessageTraceBack(invoice);
Beans.get(InvoiceService.class).validate(invoice);
response.setReload(true);
if (traceBackService.countMessageTraceBack(invoice) > tracebackCount) {
traceBackService.findLastMessageTraceBack(invoice).ifPresent(traceback -> response.setNotify(String.format(I18n.get(com.axelor.apps.message.exception.IExceptionMessage.SEND_EMAIL_EXCEPTION), traceback.getMessage())));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.exception.service.TraceBackService in project axelor-open-suite by axelor.
the class InvoiceController method ventilate.
/**
* Called from invoice form view, on clicking ventilate button. Call {@link
* InvoiceService#ventilate(Invoice)}.
*
* @param request
* @param response
*/
public void ventilate(ActionRequest request, ActionResponse response) {
Invoice invoice = request.getContext().asType(Invoice.class);
invoice = Beans.get(InvoiceRepository.class).find(invoice.getId());
try {
// we have to inject TraceBackService to use non static methods
TraceBackService traceBackService = Beans.get(TraceBackService.class);
long tracebackCount = traceBackService.countMessageTraceBack(invoice);
Beans.get(InvoiceService.class).ventilate(invoice);
response.setReload(true);
if (traceBackService.countMessageTraceBack(invoice) > tracebackCount) {
traceBackService.findLastMessageTraceBack(invoice).ifPresent(traceback -> response.setNotify(String.format(I18n.get(com.axelor.apps.message.exception.IExceptionMessage.SEND_EMAIL_EXCEPTION), traceback.getMessage())));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations