use of com.axelor.apps.account.db.InvoiceLine in project axelor-open-suite by axelor.
the class InvoiceLineProjectController method setProjectToAnalyticDistribution.
public void setProjectToAnalyticDistribution(ActionRequest request, ActionResponse response) {
try {
InvoiceLine invoiceLine = request.getContext().asType(InvoiceLine.class);
List<AnalyticMoveLine> analyticMoveLines = invoiceLine.getAnalyticMoveLineList();
if (analyticMoveLines != null) {
response.setValue("analyticMoveLineList", Beans.get(InvoiceLineProjectService.class).setProjectToAnalyticDistribution(invoiceLine, analyticMoveLines));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.account.db.InvoiceLine 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.account.db.InvoiceLine in project axelor-open-suite by axelor.
the class ProjectTaskBusinessProjectServiceImpl method createInvoiceLine.
@Override
public List<InvoiceLine> createInvoiceLine(Invoice invoice, ProjectTask projectTask, int priority) throws AxelorException {
InvoiceLineGenerator invoiceLineGenerator = new InvoiceLineGenerator(invoice, projectTask.getProduct(), projectTask.getName(), projectTask.getUnitPrice(), BigDecimal.ZERO, projectTask.getPriceDiscounted(), projectTask.getDescription(), projectTask.getQuantity(), projectTask.getUnit(), null, priority, projectTask.getDiscountAmount(), projectTask.getDiscountTypeSelect(), projectTask.getExTaxTotal(), BigDecimal.ZERO, false) {
@Override
public List<InvoiceLine> creates() throws AxelorException {
InvoiceLine invoiceLine = this.createInvoiceLine();
invoiceLine.setProject(projectTask.getProject());
invoiceLine.setSaleOrderLine(projectTask.getSaleOrderLine());
projectTask.setInvoiceLine(invoiceLine);
List<InvoiceLine> invoiceLines = new ArrayList<InvoiceLine>();
invoiceLines.add(invoiceLine);
return invoiceLines;
}
};
return invoiceLineGenerator.creates();
}
use of com.axelor.apps.account.db.InvoiceLine in project axelor-open-suite by axelor.
the class ProjectTaskBusinessProjectServiceImpl method createInvoiceLines.
@Override
public List<InvoiceLine> createInvoiceLines(Invoice invoice, List<ProjectTask> projectTaskList, int priority) throws AxelorException {
List<InvoiceLine> invoiceLineList = new ArrayList<>();
int count = 0;
for (ProjectTask projectTask : projectTaskList) {
invoiceLineList.addAll(this.createInvoiceLine(invoice, projectTask, priority * 100 + count));
count++;
}
return invoiceLineList;
}
use of com.axelor.apps.account.db.InvoiceLine in project axelor-open-suite by axelor.
the class InvoiceLineProjectServiceImpl method setProject.
@Transactional
@Override
public void setProject(List<Long> invoiceLineIds, Project project) {
if (invoiceLineIds != null) {
List<InvoiceLine> invoiceLineList = invoiceLineRepo.all().filter("self.id in ?1", invoiceLineIds).fetch();
for (InvoiceLine line : invoiceLineList) {
line.setProject(project);
invoiceLineRepo.save(line);
}
}
}
Aggregations