Search in sources :

Example 1 with ProjectInvoicingAssistantBatch

use of com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch in project axelor-open-suite by axelor.

the class ProjectInvoicingAssistantBatchController method actionUpdateTask.

public void actionUpdateTask(ActionRequest request, ActionResponse response) {
    try {
        ProjectInvoicingAssistantBatch projectInvoicingAssistantBatch = request.getContext().asType(ProjectInvoicingAssistantBatch.class);
        projectInvoicingAssistantBatch = Beans.get(ProjectInvoicingAssistantBatchRepository.class).find(projectInvoicingAssistantBatch.getId());
        Batch batch = Beans.get(ProjectInvoicingAssistantBatchService.class).updateTask(projectInvoicingAssistantBatch);
        response.setFlash(batch.getComments());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    } finally {
        response.setReload(true);
    }
}
Also used : Batch(com.axelor.apps.base.db.Batch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatchService(com.axelor.apps.businessproject.service.batch.ProjectInvoicingAssistantBatchService)

Example 2 with ProjectInvoicingAssistantBatch

use of com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch in project axelor-open-suite by axelor.

the class ProjectInvoicingAssistantBatchService method run.

@Override
public Batch run(Model model) throws AxelorException {
    Batch batch;
    ProjectInvoicingAssistantBatch projectInvoicingAssistantBatch = (ProjectInvoicingAssistantBatch) model;
    switch(projectInvoicingAssistantBatch.getActionSelect()) {
        case ProjectInvoicingAssistantBatchRepository.ACTION_UPDATE_TASKS:
            batch = updateTask(projectInvoicingAssistantBatch);
            break;
        case ProjectInvoicingAssistantBatchRepository.ACTION_GENERATE_INVOICING_PROJECT:
            batch = generateInvoicingProject(projectInvoicingAssistantBatch);
            break;
        default:
            throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), projectInvoicingAssistantBatch.getActionSelect(), projectInvoicingAssistantBatch.getCode());
    }
    return batch;
}
Also used : AxelorException(com.axelor.exception.AxelorException) Batch(com.axelor.apps.base.db.Batch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch)

Example 3 with ProjectInvoicingAssistantBatch

use of com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch in project axelor-open-suite by axelor.

the class ProjectInvoicingAssistantBatchController method actionGenerateInvoicingProject.

public void actionGenerateInvoicingProject(ActionRequest request, ActionResponse response) {
    try {
        ProjectInvoicingAssistantBatch projectInvoicingAssistantBatch = request.getContext().asType(ProjectInvoicingAssistantBatch.class);
        projectInvoicingAssistantBatch = Beans.get(ProjectInvoicingAssistantBatchRepository.class).find(projectInvoicingAssistantBatch.getId());
        Batch batch = Beans.get(ProjectInvoicingAssistantBatchService.class).generateInvoicingProject(projectInvoicingAssistantBatch);
        response.setFlash(batch.getComments());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    } finally {
        response.setReload(true);
    }
}
Also used : Batch(com.axelor.apps.base.db.Batch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatchService(com.axelor.apps.businessproject.service.batch.ProjectInvoicingAssistantBatchService)

Aggregations

Batch (com.axelor.apps.base.db.Batch)3 ProjectInvoicingAssistantBatch (com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch)3 ProjectInvoicingAssistantBatchService (com.axelor.apps.businessproject.service.batch.ProjectInvoicingAssistantBatchService)2 AxelorException (com.axelor.exception.AxelorException)1