Program: 58763
Project: 58763
Buggy source:
public StockMoveLine createStockMoveLine(StockMove stockMove,SaleOrderLine saleOrderLine,Company company) throws AxelorException {
  Product product=saleOrderLine.getProduct();
  if (product != null && this.isStockMoveProduct(saleOrderLine) && !ProductRepository.PRODUCT_TYPE_SUBSCRIPTABLE.equals(product.getProductTypeSelect())) {
    Unit unit=saleOrderLine.getProduct().getUnit();
    BigDecimal qty=saleOrderLine.getQty();
    BigDecimal priceDiscounted=saleOrderLine.getPriceDiscounted();
    if (!unit.equals(saleOrderLine.getUnit())) {
      qty=unitConversionService.convertWithProduct(saleOrderLine.getUnit(),unit,qty,saleOrderLine.getProduct());
      priceDiscounted=unitConversionService.convertWithProduct(saleOrderLine.getUnit(),unit,priceDiscounted,saleOrderLine.getProduct());
    }
    StockMoveLine stockMoveLine=stockMoveLineService.createStockMoveLine(product,saleOrderLine.getProductName(),saleOrderLine.getDescription(),qty,priceDiscounted,unit,stockMove,1,saleOrderLine.getSaleOrder().getInAti(),saleOrderLine.getTaxLine().getValue());
    stockMoveLine.setSaleOrderLine(saleOrderLine);
    if (stockMoveLine != null) {
      stockMove.addStockMoveLineListItem(stockMoveLine);
    }
    return stockMoveLine;
  }
 else   if (saleOrderLine.getIsTitleLine()) {
    StockMoveLine stockMoveLine=stockMoveLineService.createStockMoveLine(null,saleOrderLine.getProductName(),saleOrderLine.getDescription(),BigDecimal.ZERO,BigDecimal.ZERO,null,stockMove,1,saleOrderLine.getSaleOrder().getInAti(),null);
    stockMoveLine.setSaleOrderLine(saleOrderLine);
    if (stockMoveLine != null) {
      stockMove.addStockMoveLineListItem(stockMoveLine);
    }
    return stockMoveLine;
  }
  return null;
}

Fixed version (ground truth):
public StockMoveLine createStockMoveLine(StockMove stockMove,SaleOrderLine saleOrderLine,Company company) throws AxelorException {
  Product product=saleOrderLine.getProduct();
  if (product != null && this.isStockMoveProduct(saleOrderLine) && !ProductRepository.PRODUCT_TYPE_SUBSCRIPTABLE.equals(product.getProductTypeSelect())) {
    Unit unit=saleOrderLine.getProduct().getUnit();
    BigDecimal qty=saleOrderLine.getQty();
    BigDecimal priceDiscounted=saleOrderLine.getPriceDiscounted();
    if (!unit.equals(saleOrderLine.getUnit())) {
      qty=unitConversionService.convertWithProduct(saleOrderLine.getUnit(),unit,qty,saleOrderLine.getProduct());
      priceDiscounted=unitConversionService.convertWithProduct(saleOrderLine.getUnit(),unit,priceDiscounted,saleOrderLine.getProduct());
    }
    BigDecimal taxRate=BigDecimal.ZERO;
    TaxLine taxLine=saleOrderLine.getTaxLine();
    if (taxLine != null) {
      taxRate=taxLine.getValue();
    }
    StockMoveLine stockMoveLine=stockMoveLineService.createStockMoveLine(product,saleOrderLine.getProductName(),saleOrderLine.getDescription(),qty,priceDiscounted,unit,stockMove,1,saleOrderLine.getSaleOrder().getInAti(),taxRate);
    stockMoveLine.setSaleOrderLine(saleOrderLine);
    if (stockMoveLine != null) {
      stockMove.addStockMoveLineListItem(stockMoveLine);
    }
    return stockMoveLine;
  }
 else   if (saleOrderLine.getIsTitleLine()) {
    StockMoveLine stockMoveLine=stockMoveLineService.createStockMoveLine(null,saleOrderLine.getProductName(),saleOrderLine.getDescription(),BigDecimal.ZERO,BigDecimal.ZERO,null,stockMove,1,saleOrderLine.getSaleOrder().getInAti(),null);
    stockMoveLine.setSaleOrderLine(saleOrderLine);
    if (stockMoveLine != null) {
      stockMove.addStockMoveLineListItem(stockMoveLine);
    }
    return stockMoveLine;
  }
  return null;
}