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);
}
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);
}
}
Aggregations