Search in sources :

Example 11 with InvoicingProject

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

the class InvoicingProjectController method fillIn.

public void fillIn(ActionRequest request, ActionResponse response) throws AxelorException {
    InvoicingProject invoicingProject = request.getContext().asType(InvoicingProject.class);
    InvoicingProjectService invoicingProjectService = Beans.get(InvoicingProjectService.class);
    Project project = invoicingProject.getProject();
    if (project == null) {
        throw new AxelorException(TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.INVOICING_PROJECT_PROJECT));
    }
    invoicingProjectService.clearLines(invoicingProject);
    invoicingProjectService.setLines(invoicingProject, project, 0);
    response.setValues(invoicingProject);
}
Also used : InvoicingProject(com.axelor.apps.businessproject.db.InvoicingProject) Project(com.axelor.apps.project.db.Project) AxelorException(com.axelor.exception.AxelorException) InvoicingProjectService(com.axelor.apps.businessproject.service.InvoicingProjectService) InvoicingProject(com.axelor.apps.businessproject.db.InvoicingProject)

Example 12 with InvoicingProject

use of com.axelor.apps.businessproject.db.InvoicingProject 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);
    }
}
Also used : PurchaseOrderLine(com.axelor.apps.purchase.db.PurchaseOrderLine) InvoicingProject(com.axelor.apps.businessproject.db.InvoicingProject) Project(com.axelor.apps.project.db.Project) TimesheetLine(com.axelor.apps.hr.db.TimesheetLine) ExpenseLine(com.axelor.apps.hr.db.ExpenseLine) ProjectTask(com.axelor.apps.project.db.ProjectTask) SaleOrderLine(com.axelor.apps.sale.db.SaleOrderLine) 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