use of com.axelor.apps.project.db.repo.ProjectTaskRepository in project axelor-open-suite by axelor.
the class ProjectTaskController method updateToInvoice.
/**
* Invert value of 'toInvoice' field and save the record
*
* @param request
* @param response
*/
@Transactional
public void updateToInvoice(ActionRequest request, ActionResponse response) {
ProjectTaskRepository projectTaskRepository = Beans.get(ProjectTaskRepository.class);
try {
ProjectTask projectTask = request.getContext().asType(ProjectTask.class);
projectTask = projectTaskRepository.find(projectTask.getId());
projectTask.setToInvoice(!projectTask.getToInvoice());
projectTaskRepository.save(projectTask);
response.setValue("toInvoice", projectTask.getToInvoice());
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations