Search in sources :

Example 1 with InvoicingProject

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

the class InvoicingProjectService method setLines.

public void setLines(InvoicingProject invoicingProject, Project project, int counter) {
    if (counter > ProjectServiceImpl.MAX_LEVEL_OF_PROJECT) {
        return;
    }
    counter++;
    this.fillLines(invoicingProject, project);
    if (!invoicingProject.getConsolidatePhaseWhenInvoicing()) {
        return;
    }
    List<Project> projectChildrenList = Beans.get(ProjectRepository.class).all().filter("self.parentProject = ?1", project).fetch();
    for (Project projectChild : projectChildrenList) {
        this.setLines(invoicingProject, projectChild, counter);
    }
    return;
}
Also used : InvoicingProject(com.axelor.apps.businessproject.db.InvoicingProject) Project(com.axelor.apps.project.db.Project) ProjectRepository(com.axelor.apps.project.db.repo.ProjectRepository) InvoicingProjectRepository(com.axelor.apps.businessproject.db.repo.InvoicingProjectRepository)

Example 2 with InvoicingProject

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

the class InvoicingProjectServiceBusinessProdImpl method setLines.

@Override
public void setLines(InvoicingProject invoicingProject, Project project, int counter) {
    AppProductionService appProductionService = Beans.get(AppProductionService.class);
    if (!appProductionService.isApp("production") || !appProductionService.getAppProduction().getManageBusinessProduction()) {
        super.setLines(invoicingProject, project, counter);
        return;
    }
    if (counter > ProjectServiceImpl.MAX_LEVEL_OF_PROJECT) {
        return;
    }
    counter++;
    this.fillLines(invoicingProject, project);
    if (!invoicingProject.getConsolidatePhaseWhenInvoicing()) {
        return;
    }
    List<Project> projectChildrenList = Beans.get(ProjectRepository.class).all().filter("self.parentProject = ?1", project).fetch();
    for (Project projectChild : projectChildrenList) {
        this.setLines(invoicingProject, projectChild, counter);
    }
    return;
}
Also used : InvoicingProject(com.axelor.apps.businessproject.db.InvoicingProject) Project(com.axelor.apps.project.db.Project) ProjectRepository(com.axelor.apps.project.db.repo.ProjectRepository) AppProductionService(com.axelor.apps.production.service.app.AppProductionService)

Example 3 with InvoicingProject

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

the class WorkflowCancelServiceProjectImpl method afterCancel.

@Override
@Transactional(rollbackOn = { Exception.class })
public void afterCancel(Invoice invoice) throws AxelorException {
    super.afterCancel(invoice);
    InvoicingProject invoicingProject = invoicingProjectRepo.all().filter("self.invoice = ?", invoice.getId()).fetchOne();
    if (invoicingProject != null) {
        invoicingProject.setStatusSelect(InvoicingProjectRepository.STATUS_CANCELED);
        invoicingProjectRepo.save(invoicingProject);
    }
}
Also used : InvoicingProject(com.axelor.apps.businessproject.db.InvoicingProject) Transactional(com.google.inject.persist.Transactional)

Example 4 with InvoicingProject

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

the class WorkflowValidationServiceProjectImpl method afterValidation.

@Override
@Transactional(rollbackOn = { Exception.class })
public void afterValidation(Invoice invoice) throws AxelorException {
    super.afterValidation(invoice);
    InvoicingProject invoicingProject = invoicingProjectRepo.all().filter("self.invoice = ?", invoice.getId()).fetchOne();
    if (invoicingProject != null) {
        invoicingProject.setStatusSelect(InvoicingProjectRepository.STATUS_VALIDATED);
        invoicingProjectRepo.save(invoicingProject);
    }
}
Also used : InvoicingProject(com.axelor.apps.businessproject.db.InvoicingProject) Transactional(com.google.inject.persist.Transactional)

Example 5 with InvoicingProject

use of com.axelor.apps.businessproject.db.InvoicingProject 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)

Aggregations

InvoicingProject (com.axelor.apps.businessproject.db.InvoicingProject)12 Project (com.axelor.apps.project.db.Project)6 Transactional (com.google.inject.persist.Transactional)6 Invoice (com.axelor.apps.account.db.Invoice)3 ProjectTask (com.axelor.apps.project.db.ProjectTask)3 InvoicingProjectService (com.axelor.apps.businessproject.service.InvoicingProjectService)2 ProjectRepository (com.axelor.apps.project.db.repo.ProjectRepository)2 AxelorException (com.axelor.exception.AxelorException)2 ArrayList (java.util.ArrayList)2 AccountConfig (com.axelor.apps.account.db.AccountConfig)1 InvoiceRepository (com.axelor.apps.account.db.repo.InvoiceRepository)1 AccountConfigService (com.axelor.apps.account.service.config.AccountConfigService)1 InvoiceGenerator (com.axelor.apps.account.service.invoice.generator.InvoiceGenerator)1 Company (com.axelor.apps.base.db.Company)1 Partner (com.axelor.apps.base.db.Partner)1 InvoicingProjectRepository (com.axelor.apps.businessproject.db.repo.InvoicingProjectRepository)1 AppBusinessProjectService (com.axelor.apps.businessproject.service.app.AppBusinessProjectService)1 ExpenseLine (com.axelor.apps.hr.db.ExpenseLine)1 TimesheetLine (com.axelor.apps.hr.db.TimesheetLine)1 AppProductionService (com.axelor.apps.production.service.app.AppProductionService)1