Program: 59142
Project: 59142
Buggy source:
/** 
 * @return
 * @throws AxelorException 
 */
protected InvoiceLine createInvoiceLine() throws AxelorException {
  InvoiceLine invoiceLine=new InvoiceLine();
  invoiceLine.setInvoice(invoice);
  invoiceLine.setProduct(product);
  invoiceLine.setProductName(productName);
  invoiceLine.setDescription(description);
  invoiceLine.setPrice(price);
  invoiceLine.setQty(qty);
  if (exTaxTotal == null) {
    exTaxTotal=computeAmount(qty,price);
  }
  invoiceLine.setExTaxTotal(exTaxTotal);
  Partner partner=invoice.getPartner();
  Currency partnerCurrency=partner.getCurrency();
  if (partnerCurrency == null) {
    throw new AxelorException(String.format("String_Node_Str",partner.getFullName(),partner.getPartnerSeq()),IException.CONFIGURATION_ERROR);
  }
  invoiceLine.setAccountingExTaxTotal(currencyService.getAmountCurrencyConverted(invoice.getCurrency(),partnerCurrency,exTaxTotal,invoice.getInvoiceDate()));
  invoiceLine.setPricingListUnit(unit);
  if (vatLine == null) {
    boolean isPurchase=false;
    if (invoice.getOperationTypeSelect() == IInvoice.SUPPLIER_PURCHASE || invoice.getOperationTypeSelect() == IInvoice.SUPPLIER_REFUND) {
      isPurchase=true;
    }
    vatLine=accountManagementService.getVatLine(invoice.getInvoiceDate(),product,invoice.getCompany(),isPurchase);
  }
  invoiceLine.setVatLine(vatLine);
  invoiceLine.setTask(task);
  invoiceLine.setInvoiceLineType(invoiceLineType);
  invoiceLine.setProductVariant(productVariant);
  invoiceLine.setDiscountTypeSelect(discountTypeSelect);
  invoiceLine.setDiscountAmount(discountAmount);
  return invoiceLine;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws AxelorException 
 */
protected InvoiceLine createInvoiceLine() throws AxelorException {
  InvoiceLine invoiceLine=new InvoiceLine();
  invoiceLine.setInvoice(invoice);
  invoiceLine.setProduct(product);
  invoiceLine.setProductName(productName);
  invoiceLine.setDescription(description);
  invoiceLine.setPrice(price);
  invoiceLine.setQty(qty);
  if (exTaxTotal == null) {
    exTaxTotal=computeAmount(qty,price);
  }
  invoiceLine.setExTaxTotal(exTaxTotal);
  Partner partner=invoice.getPartner();
  Currency partnerCurrency=partner.getCurrency();
  if (partnerCurrency == null) {
    throw new AxelorException(String.format("String_Node_Str",partner.getFullName(),partner.getPartnerSeq()),IException.CONFIGURATION_ERROR);
  }
  invoiceLine.setAccountingExTaxTotal(currencyService.getAmountCurrencyConverted(invoice.getCurrency(),partnerCurrency,exTaxTotal,invoice.getInvoiceDate()));
  Company company=invoice.getCompany();
  Currency companyCurrency=company.getCurrency();
  if (companyCurrency == null) {
    throw new AxelorException(String.format("String_Node_Str",company.getName()),IException.CONFIGURATION_ERROR);
  }
  invoiceLine.setCompanyExTaxTotal(currencyService.getAmountCurrencyConverted(invoice.getCurrency(),companyCurrency,exTaxTotal,invoice.getInvoiceDate()));
  invoiceLine.setPricingListUnit(unit);
  if (vatLine == null) {
    boolean isPurchase=false;
    if (invoice.getOperationTypeSelect() == IInvoice.SUPPLIER_PURCHASE || invoice.getOperationTypeSelect() == IInvoice.SUPPLIER_REFUND) {
      isPurchase=true;
    }
    vatLine=new AccountManagementService().getVatLine(invoice.getInvoiceDate(),product,invoice.getCompany(),isPurchase);
  }
  invoiceLine.setVatLine(vatLine);
  invoiceLine.setTask(task);
  invoiceLine.setInvoiceLineType(invoiceLineType);
  invoiceLine.setProductVariant(productVariant);
  invoiceLine.setDiscountTypeSelect(discountTypeSelect);
  invoiceLine.setDiscountAmount(discountAmount);
  return invoiceLine;
}