public String generateRemission() {
HttpServletRequest request = getRequest();
Date date = new Date();
User requestUser = userManager.getUserByUsername(request.getRemoteUser());
Remission remission = new Remission();
remission.setWorkOrder(workOrder);
remission.setDescription(workOrder.getDescription());
remission.setDate(date);
remission.setEmployee(null);
remission.setCreatedBy(requestUser);
remission.setModifiedBy(requestUser);
remission.setCreatedOn(date);
remission.setModifiedOn(date);
for (WorkOrderDetail qDetail : workOrder.getDetails()) {
RemissionDetail remissionDetail = new RemissionDetail();
remissionDetail.setQuotationDetail(qDetail.getQuotationDetail());
remission.addDetail(remissionDetail);
qDetail.setStatus(WorkOrderStatus.REMITIDA);
}
remissionManager.save(remission);