use of com.axelor.apps.project.db.ProjectTask in project axelor-open-suite by axelor.
the class WorkflowVentilationProjectServiceImpl method afterVentilation.
@Override
@Transactional(rollbackOn = { Exception.class })
public void afterVentilation(Invoice invoice) throws AxelorException {
super.afterVentilation(invoice);
if (!Beans.get(AppBusinessProjectService.class).isApp("business-project")) {
return;
}
InvoicingProject invoicingProject = invoicingProjectRepo.all().filter("self.invoice.id = ?", invoice.getId()).fetchOne();
if (invoicingProject != null) {
for (SaleOrderLine saleOrderLine : invoicingProject.getSaleOrderLineSet()) {
saleOrderLine.setInvoiced(true);
}
for (PurchaseOrderLine purchaseOrderLine : invoicingProject.getPurchaseOrderLineSet()) {
purchaseOrderLine.setInvoiced(true);
}
for (TimesheetLine timesheetLine : invoicingProject.getLogTimesSet()) {
timesheetLine.setInvoiced(true);
if (timesheetLine.getProjectTask() == null) {
continue;
}
timesheetLine.getProjectTask().setInvoiced(this.checkInvoicedTimesheetLines(timesheetLine.getProjectTask()));
}
for (ExpenseLine expenseLine : invoicingProject.getExpenseLineSet()) {
expenseLine.setInvoiced(true);
}
for (ProjectTask projectTask : invoicingProject.getProjectTaskSet()) {
projectTask.setInvoiced(true);
}
for (Project project : invoicingProject.getProjectSet()) {
project.setInvoiced(true);
}
invoicingProject.setStatusSelect(InvoicingProjectRepository.STATUS_VENTILATED);
invoicingProjectRepo.save(invoicingProject);
}
}
use of com.axelor.apps.project.db.ProjectTask in project axelor-open-suite by axelor.
the class ProjectTaskBusinessProjectServiceImpl method create.
@Override
public ProjectTask create(TaskTemplate template, Project project, LocalDateTime date, BigDecimal qty) {
ProjectTask task = create(template.getName(), project, template.getAssignedTo());
task.setTaskDate(date.toLocalDate());
task.setTaskEndDate(date.plusHours(template.getDuration().longValue()).toLocalDate());
BigDecimal plannedHrs = template.getTotalPlannedHrs();
if (template.getIsUniqueTaskForMultipleQuantity() && qty.compareTo(BigDecimal.ONE) > 0) {
plannedHrs = plannedHrs.multiply(qty);
task.setName(task.getName() + " x" + qty.intValue());
}
task.setTotalPlannedHrs(plannedHrs);
return task;
}
use of com.axelor.apps.project.db.ProjectTask in project axelor-open-suite by axelor.
the class ProjectTaskBusinessProjectServiceImpl method create.
@Override
public ProjectTask create(SaleOrderLine saleOrderLine, Project project, User assignedTo) throws AxelorException {
ProjectTask task = create(saleOrderLine.getFullName() + "_task", project, assignedTo);
task.setProduct(saleOrderLine.getProduct());
task.setUnit(saleOrderLine.getUnit());
task.setCurrency(project.getClientPartner().getCurrency());
if (project.getPriceList() != null) {
PriceListLine line = priceListLineRepo.findByPriceListAndProduct(project.getPriceList(), saleOrderLine.getProduct());
if (line != null) {
task.setUnitPrice(line.getAmount());
}
}
if (task.getUnitPrice() == null) {
Company company = saleOrderLine.getSaleOrder() != null ? saleOrderLine.getSaleOrder().getCompany() : null;
task.setUnitPrice((BigDecimal) productCompanyService.get(saleOrderLine.getProduct(), "salePrice", company));
}
task.setDescription(saleOrderLine.getDescription());
task.setQuantity(saleOrderLine.getQty());
task.setSaleOrderLine(saleOrderLine);
task.setToInvoice(saleOrderLine.getSaleOrder() != null ? saleOrderLine.getSaleOrder().getToInvoiceViaTask() : false);
return task;
}
use of com.axelor.apps.project.db.ProjectTask in project axelor-open-suite by axelor.
the class ProjectTaskBusinessSupportRepository method copy.
@Override
public ProjectTask copy(ProjectTask entity, boolean deep) {
ProjectTask task = super.copy(entity, deep);
task.setTargetVersion(null);
return task;
}
use of com.axelor.apps.project.db.ProjectTask in project axelor-open-suite by axelor.
the class ProjectBusinessSupportServiceImpl method createTask.
@Override
public ProjectTask createTask(TaskTemplate taskTemplate, Project project, Set<TaskTemplate> taskTemplateSet) {
ProjectTask task = super.createTask(taskTemplate, project, taskTemplateSet);
task.setInternalDescription(taskTemplate.getInternalDescription());
return task;
}
Aggregations