Search in sources :

Example 11 with ProjectTask

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

the class ProjectTaskController method cancelTimer.

public void cancelTimer(ActionRequest request, ActionResponse response) {
    try {
        ProjectTask task = request.getContext().asType(ProjectTask.class);
        Beans.get(TimerProjectTaskService.class).cancel(task);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : TimerProjectTaskService(com.axelor.apps.project.service.TimerProjectTaskService) ProjectTask(com.axelor.apps.project.db.ProjectTask)

Example 12 with ProjectTask

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

the class ProjectTaskController method startTimer.

public void startTimer(ActionRequest request, ActionResponse response) {
    try {
        ProjectTask task = request.getContext().asType(ProjectTask.class);
        Beans.get(TimerProjectTaskService.class).start(task, Beans.get(AppBaseService.class).getTodayDateTime().toLocalDateTime());
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : TimerProjectTaskService(com.axelor.apps.project.service.TimerProjectTaskService) AppBaseService(com.axelor.apps.base.service.app.AppBaseService) ProjectTask(com.axelor.apps.project.db.ProjectTask)

Example 13 with ProjectTask

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

the class ProjectTaskController method computeTotalTimerDuration.

public void computeTotalTimerDuration(ActionRequest request, ActionResponse response) {
    try {
        ProjectTask task = request.getContext().asType(ProjectTask.class);
        if (task.getId() == null) {
            return;
        }
        Duration duration = Beans.get(TimerProjectTaskService.class).compute(task);
        response.setValue("$_totalTimerDuration", duration.toMinutes() / 60F);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : TimerProjectTaskService(com.axelor.apps.project.service.TimerProjectTaskService) ProjectTask(com.axelor.apps.project.db.ProjectTask) Duration(java.time.Duration)

Example 14 with ProjectTask

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

the class ProjectTaskController method stopTimer.

public void stopTimer(ActionRequest request, ActionResponse response) {
    try {
        ProjectTask task = request.getContext().asType(ProjectTask.class);
        Beans.get(TimerProjectTaskService.class).stop(task, Beans.get(AppBaseService.class).getTodayDateTime().toLocalDateTime());
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : TimerProjectTaskService(com.axelor.apps.project.service.TimerProjectTaskService) AppBaseService(com.axelor.apps.base.service.app.AppBaseService) ProjectTask(com.axelor.apps.project.db.ProjectTask)

Example 15 with ProjectTask

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

the class ProjectTaskServiceImpl method removeNextTasks.

@Override
@Transactional
public void removeNextTasks(ProjectTask projectTask) {
    List<ProjectTask> projectTaskList = getAllNextTasks(projectTask);
    projectTask.setNextProjectTask(null);
    projectTask.setHasDateOrFrequencyChanged(false);
    projectTaskRepo.save(projectTask);
    for (ProjectTask projectTaskToRemove : projectTaskList) {
        projectTaskRepo.remove(projectTaskToRemove);
    }
}
Also used : ProjectTask(com.axelor.apps.project.db.ProjectTask) Transactional(com.google.inject.persist.Transactional)

Aggregations

ProjectTask (com.axelor.apps.project.db.ProjectTask)43 Transactional (com.google.inject.persist.Transactional)14 ArrayList (java.util.ArrayList)7 Project (com.axelor.apps.project.db.Project)6 TimerProjectTaskService (com.axelor.apps.project.service.TimerProjectTaskService)6 BigDecimal (java.math.BigDecimal)5 Product (com.axelor.apps.base.db.Product)4 SaleOrderLine (com.axelor.apps.sale.db.SaleOrderLine)4 InvoicingProject (com.axelor.apps.businessproject.db.InvoicingProject)3 TimesheetLine (com.axelor.apps.hr.db.TimesheetLine)3 ProjectTaskRepository (com.axelor.apps.project.db.repo.ProjectTaskRepository)3 AxelorException (com.axelor.exception.AxelorException)3 LocalDateTime (java.time.LocalDateTime)3 InvoiceLine (com.axelor.apps.account.db.InvoiceLine)2 Timer (com.axelor.apps.base.db.Timer)2 TimerHistory (com.axelor.apps.base.db.TimerHistory)2 AppBaseService (com.axelor.apps.base.service.app.AppBaseService)2 ExpenseLine (com.axelor.apps.hr.db.ExpenseLine)2 ProjectPlanningTime (com.axelor.apps.project.db.ProjectPlanningTime)2 ProjectTaskCategory (com.axelor.apps.project.db.ProjectTaskCategory)2