use of com.axelor.apps.purchase.db.PurchaseOrderLine in project axelor-open-suite by axelor.
the class ProjectStockMoveInvoiceServiceImpl method createInvoiceLine.
@Override
public InvoiceLine createInvoiceLine(Invoice invoice, StockMoveLine stockMoveLine, BigDecimal qty) throws AxelorException {
InvoiceLine invoiceLine = super.createInvoiceLine(invoice, stockMoveLine, qty);
if (invoiceLine == null || !Beans.get(AppBusinessProjectService.class).isApp("business-project")) {
return invoiceLine;
}
SaleOrderLine saleOrderLine = invoiceLine.getSaleOrderLine();
if (saleOrderLine != null) {
invoiceLine.setProject(saleOrderLine.getProject());
}
PurchaseOrderLine purchaseOrderLine = invoiceLine.getPurchaseOrderLine();
if (purchaseOrderLine != null) {
invoiceLine.setProject(purchaseOrderLine.getProject());
}
return invoiceLine;
}
use of com.axelor.apps.purchase.db.PurchaseOrderLine in project axelor-open-suite by axelor.
the class PurchaseOrderLineServiceProjectImpl method createAnalyticDistributionWithTemplate.
@Override
public PurchaseOrderLine createAnalyticDistributionWithTemplate(PurchaseOrderLine purchaseOrderLine) {
PurchaseOrderLine poLine = super.createAnalyticDistributionWithTemplate(purchaseOrderLine);
List<AnalyticMoveLine> analyticMoveLineList = poLine.getAnalyticMoveLineList();
if (poLine.getProject() != null && analyticMoveLineList != null) {
analyticMoveLineList.forEach(analyticLine -> analyticLine.setProject(poLine.getProject()));
}
return poLine;
}
use of com.axelor.apps.purchase.db.PurchaseOrderLine in project axelor-open-suite by axelor.
the class PurchaseOrderLineServiceProjectImpl method setProject.
@Transactional
@Override
public void setProject(List<Long> purchaseOrderLineIds, Project project) {
if (purchaseOrderLineIds != null) {
List<PurchaseOrderLine> purchaseOrderLineList = purchaseOrderLineRepo.all().filter("self.id in ?1", purchaseOrderLineIds).fetch();
for (PurchaseOrderLine line : purchaseOrderLineList) {
line.setProject(project);
purchaseOrderLineRepo.save(line);
}
}
}
use of com.axelor.apps.purchase.db.PurchaseOrderLine in project axelor-open-suite by axelor.
the class PurchaseOrderWorkflowServiceProjectImpl method cancelPurchaseOrder.
@Override
@Transactional
public void cancelPurchaseOrder(PurchaseOrder purchaseOrder) {
super.cancelPurchaseOrder(purchaseOrder);
for (PurchaseOrderLine purchaseOrderLine : purchaseOrder.getPurchaseOrderLineList()) {
for (AnalyticMoveLine analyticMoveLine : purchaseOrderLine.getAnalyticMoveLineList()) {
analyticMoveLine.setProject(null);
analyticMoveLineRepository.save(analyticMoveLine);
}
}
}
use of com.axelor.apps.purchase.db.PurchaseOrderLine in project axelor-open-suite by axelor.
the class InvoicingProjectService method populate.
public List<InvoiceLine> populate(Invoice invoice, InvoicingProject folder) throws AxelorException {
List<SaleOrderLine> saleOrderLineList = new ArrayList<SaleOrderLine>(folder.getSaleOrderLineSet());
List<PurchaseOrderLine> purchaseOrderLineList = new ArrayList<PurchaseOrderLine>(folder.getPurchaseOrderLineSet());
List<TimesheetLine> timesheetLineList = new ArrayList<TimesheetLine>(folder.getLogTimesSet());
List<ExpenseLine> expenseLineList = new ArrayList<ExpenseLine>(folder.getExpenseLineSet());
List<ProjectTask> projectTaskList = new ArrayList<ProjectTask>(folder.getProjectTaskSet());
List<InvoiceLine> invoiceLineList = new ArrayList<InvoiceLine>();
invoiceLineList.addAll(this.createSaleOrderInvoiceLines(invoice, saleOrderLineList, folder.getSaleOrderLineSetPrioritySelect()));
invoiceLineList.addAll(this.createPurchaseOrderInvoiceLines(invoice, purchaseOrderLineList, folder.getPurchaseOrderLineSetPrioritySelect()));
invoiceLineList.addAll(timesheetService.createInvoiceLines(invoice, timesheetLineList, folder.getLogTimesSetPrioritySelect()));
invoiceLineList.addAll(expenseService.createInvoiceLines(invoice, expenseLineList, folder.getExpenseLineSetPrioritySelect()));
invoiceLineList.addAll(projectTaskBusinessProjectService.createInvoiceLines(invoice, projectTaskList, folder.getProjectTaskSetPrioritySelect()));
Collections.sort(invoiceLineList, new InvoiceLineComparator());
for (InvoiceLine invoiceLine : invoiceLineList) {
invoiceLine.setSequence(sequence);
sequence++;
}
return invoiceLineList;
}
Aggregations