Search in sources :

Example 21 with ProjectTask

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

the class ProjectPlanningTimeHRRepository method remove.

@Override
public void remove(ProjectPlanningTime projectPlanningTime) {
    Project project = projectPlanningTime.getProject();
    ProjectTask task = projectPlanningTime.getProjectTask();
    super.remove(projectPlanningTime);
    if (task != null) {
        projectTaskRepo.save(task);
    } else {
        projectRepo.save(project);
    }
}
Also used : Project(com.axelor.apps.project.db.Project) ProjectTask(com.axelor.apps.project.db.ProjectTask)

Example 22 with ProjectTask

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

the class ProjectTaskHRRepository method copy.

@Override
public ProjectTask copy(ProjectTask entity, boolean deep) {
    ProjectTask task = super.copy(entity, deep);
    task.setTotalPlannedHrs(null);
    task.setTotalRealHrs(null);
    task.clearProjectPlanningTimeList();
    return task;
}
Also used : ProjectTask(com.axelor.apps.project.db.ProjectTask)

Example 23 with ProjectTask

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

the class InvoicePaymentValidateProjectServiceImpl method validate.

@Override
@Transactional(rollbackOn = { Exception.class })
public void validate(InvoicePayment invoicePayment, boolean force) throws AxelorException, JAXBException, IOException, DatatypeConfigurationException {
    super.validate(invoicePayment, force);
    Invoice invoice = invoicePayment.getInvoice();
    InvoicingProject invoicingProject = invoicingProjectRepo.all().filter("self.invoice.id = ?1 AND self.project.invoicingSequenceSelect = ?2", invoice.getId(), ProjectRepository.INVOICING_SEQ_INVOICE_PRE_TASK).fetchOne();
    if (invoicingProject != null) {
        for (ProjectTask projectTask : invoicingProject.getProjectTaskSet()) {
            projectTask.setIsPaid(invoice.getHasPendingPayments());
        }
    }
}
Also used : Invoice(com.axelor.apps.account.db.Invoice) ProjectTask(com.axelor.apps.project.db.ProjectTask) InvoicingProject(com.axelor.apps.businessproject.db.InvoicingProject) Transactional(com.google.inject.persist.Transactional)

Example 24 with ProjectTask

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

the class InvoiceProjectRepository method remove.

@Override
public void remove(Invoice entity) {
    if (Beans.get(AppBusinessProjectService.class).isApp("business-project")) {
        List<InvoicingProject> invoiceProjectList = Beans.get(InvoicingProjectRepository.class).all().filter("self.invoice.id = ?", entity.getId()).fetch();
        List<ProjectTask> projectTaskList = Beans.get(ProjectTaskRepository.class).all().filter("self.invoiceLine.invoice = ?1", entity).fetch();
        if (ObjectUtils.notEmpty(projectTaskList)) {
            for (ProjectTask projectTask : projectTaskList) {
                projectTask.setInvoiceLine(null);
            }
        }
        for (InvoicingProject invoiceProject : invoiceProjectList) {
            invoiceProject.setInvoice(null);
            invoiceProject.setStatusSelect(InvoicingProjectRepository.STATUS_DRAFT);
        }
    }
    super.remove(entity);
}
Also used : AppBusinessProjectService(com.axelor.apps.businessproject.service.app.AppBusinessProjectService) ProjectTaskRepository(com.axelor.apps.project.db.repo.ProjectTaskRepository) ProjectTask(com.axelor.apps.project.db.ProjectTask) InvoicingProject(com.axelor.apps.businessproject.db.InvoicingProject)

Example 25 with ProjectTask

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

the class ProjectTaskBusinessProjectRepository method copy.

@Override
public ProjectTask copy(ProjectTask entity, boolean deep) {
    ProjectTask task = super.copy(entity, deep);
    task.setSaleOrderLine(null);
    task.setInvoiceLine(null);
    return task;
}
Also used : ProjectTask(com.axelor.apps.project.db.ProjectTask)

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