Program: 58934
Project: 58934
Buggy source:
public void compute(ActionRequest request,ActionResponse response) throws AxelorException {
  InvoiceLine invoiceLine=request.getContext().asType(InvoiceLine.class);
  BigDecimal exTaxTotal=BigDecimal.ZERO;
  BigDecimal accountingExTaxTotal=BigDecimal.ZERO;
  BigDecimal companyExTaxTotal=BigDecimal.ZERO;
  BigDecimal inTaxTotal=BigDecimal.ZERO;
  BigDecimal companyInTaxTotal=BigDecimal.ZERO;
  BigDecimal priceDiscounted=BigDecimal.ZERO;
  if (!request.getContext().getParentContext().asType(Invoice.class).getInAti()) {
    if (invoiceLine.getPrice() != null && invoiceLine.getQty() != null) {
      exTaxTotal=InvoiceLineManagement.computeAmount(invoiceLine.getQty(),invoiceLineService.computeDiscount(invoiceLine));
      inTaxTotal=exTaxTotal.add(exTaxTotal.multiply(invoiceLine.getTaxLine().getValue()));
      priceDiscounted=invoiceLineService.computeDiscount(invoiceLine);
    }
    if (exTaxTotal != null) {
      Invoice invoice=invoiceLine.getInvoice();
      if (invoice == null) {
        invoice=request.getContext().getParentContext().asType(Invoice.class);
      }
      if (invoice != null) {
        accountingExTaxTotal=invoiceLineService.getAccountingExTaxTotal(exTaxTotal,invoice);
        companyExTaxTotal=invoiceLineService.getCompanyExTaxTotal(exTaxTotal,invoice);
      }
    }
    response.setValue("String_Node_Str",exTaxTotal);
    response.setValue("String_Node_Str",inTaxTotal);
    response.setValue("String_Node_Str",accountingExTaxTotal);
    response.setValue("String_Node_Str",companyExTaxTotal);
    response.setValue("String_Node_Str",priceDiscounted);
  }
 else {
    if (invoiceLine.getPrice() != null && invoiceLine.getQty() != null) {
      inTaxTotal=InvoiceLineManagement.computeAmount(invoiceLine.getQty(),invoiceLineService.computeDiscount(invoiceLine));
      exTaxTotal=inTaxTotal.divide(invoiceLine.getTaxLine().getValue().add(new BigDecimal(1)),2,BigDecimal.ROUND_HALF_UP);
      priceDiscounted=invoiceLineService.computeDiscount(invoiceLine);
    }
    if (inTaxTotal != null) {
      Invoice invoice=invoiceLine.getInvoice();
      if (invoice == null) {
        invoice=request.getContext().getParentContext().asType(Invoice.class);
      }
      if (invoice != null) {
        accountingExTaxTotal=invoiceLineService.getAccountingExTaxTotal(inTaxTotal,invoice);
        companyInTaxTotal=invoiceLineService.getCompanyExTaxTotal(inTaxTotal,invoice);
      }
    }
    response.setValue("String_Node_Str",exTaxTotal);
    response.setValue("String_Node_Str",inTaxTotal);
    response.setValue("String_Node_Str",accountingExTaxTotal);
    response.setValue("String_Node_Str",companyInTaxTotal);
    response.setValue("String_Node_Str",priceDiscounted);
  }
}

Fixed version (ground truth):
public void compute(ActionRequest request,ActionResponse response) throws AxelorException {
  InvoiceLine invoiceLine=request.getContext().asType(InvoiceLine.class);
  BigDecimal exTaxTotal=BigDecimal.ZERO;
  BigDecimal accountingExTaxTotal=BigDecimal.ZERO;
  BigDecimal companyExTaxTotal=BigDecimal.ZERO;
  BigDecimal inTaxTotal=BigDecimal.ZERO;
  BigDecimal companyInTaxTotal=BigDecimal.ZERO;
  BigDecimal priceDiscounted=BigDecimal.ZERO;
  Invoice invoice=invoiceLine.getInvoice();
  if (invoice == null) {
    invoice=request.getContext().getParentContext().asType(Invoice.class);
  }
  if (!request.getContext().getParentContext().asType(Invoice.class).getInAti()) {
    if (invoiceLine.getPrice() != null && invoiceLine.getQty() != null) {
      exTaxTotal=InvoiceLineManagement.computeAmount(invoiceLine.getQty(),invoiceLineService.computeDiscount(invoiceLine,invoice));
      inTaxTotal=exTaxTotal.add(exTaxTotal.multiply(invoiceLine.getTaxLine().getValue()));
      priceDiscounted=invoiceLineService.computeDiscount(invoiceLine,invoice);
    }
    if (exTaxTotal != null) {
      if (invoice != null) {
        accountingExTaxTotal=invoiceLineService.getAccountingExTaxTotal(exTaxTotal,invoice);
        companyExTaxTotal=invoiceLineService.getCompanyExTaxTotal(exTaxTotal,invoice);
      }
    }
    response.setValue("String_Node_Str",exTaxTotal);
    response.setValue("String_Node_Str",inTaxTotal);
    response.setValue("String_Node_Str",accountingExTaxTotal);
    response.setValue("String_Node_Str",companyExTaxTotal);
    response.setValue("String_Node_Str",priceDiscounted);
  }
 else {
    if (invoiceLine.getPrice() != null && invoiceLine.getQty() != null) {
      inTaxTotal=InvoiceLineManagement.computeAmount(invoiceLine.getQty(),invoiceLineService.computeDiscount(invoiceLine,invoice));
      exTaxTotal=inTaxTotal.divide(invoiceLine.getTaxLine().getValue().add(new BigDecimal(1)),2,BigDecimal.ROUND_HALF_UP);
      priceDiscounted=invoiceLineService.computeDiscount(invoiceLine,invoice);
    }
    if (inTaxTotal != null) {
      if (invoice != null) {
        accountingExTaxTotal=invoiceLineService.getAccountingExTaxTotal(inTaxTotal,invoice);
        companyInTaxTotal=invoiceLineService.getCompanyExTaxTotal(inTaxTotal,invoice);
      }
    }
    response.setValue("String_Node_Str",exTaxTotal);
    response.setValue("String_Node_Str",inTaxTotal);
    response.setValue("String_Node_Str",accountingExTaxTotal);
    response.setValue("String_Node_Str",companyInTaxTotal);
    response.setValue("String_Node_Str",priceDiscounted);
  }
}