Program: 59137
Project: 59137
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()));
  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 (taxLine == null) {
    boolean isPurchase=false;
    if (invoice.getOperationTypeSelect() == IInvoice.SUPPLIER_PURCHASE || invoice.getOperationTypeSelect() == IInvoice.SUPPLIER_REFUND) {
      isPurchase=true;
    }
    taxLine=new AccountManagementService().getTaxLine(invoice.getInvoiceDate(),product,invoice.getCompany(),partner.getFiscalPosition(),isPurchase);
  }
  invoiceLine.setTaxLine(taxLine);
  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 (taxLine == null) {
    boolean isPurchase=false;
    if (invoice.getOperationTypeSelect() == IInvoice.SUPPLIER_PURCHASE || invoice.getOperationTypeSelect() == IInvoice.SUPPLIER_REFUND) {
      isPurchase=true;
    }
    taxLine=accountManagementService.getTaxLine(invoice.getInvoiceDate(),product,invoice.getCompany(),partner.getFiscalPosition(),isPurchase);
  }
  invoiceLine.setTaxLine(taxLine);
  invoiceLine.setTask(task);
  invoiceLine.setInvoiceLineType(invoiceLineType);
  invoiceLine.setProductVariant(productVariant);
  invoiceLine.setDiscountTypeSelect(discountTypeSelect);
  invoiceLine.setDiscountAmount(discountAmount);
  return invoiceLine;
}