Program: 59099
Project: 59099
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void generatePurchaseOrder(Product product,BigDecimal qty,Location location,Project project,int type) throws AxelorException {
  MinStockRules minStockRules=this.getMinStockRules(product,location,type);
  if (minStockRules != null && minStockRules.getMinQty().compareTo(qty) == 1) {
    if (minStockRules.getOrderAlertSelect() == IMinStockRules.ORDER_ALERT_PURCHASE_ORDER) {
      Partner supplierPartner=product.getDefaultSupplierPartner();
      if (supplierPartner != null) {
        Company company=location.getCompany();
        PurchaseOrder purchaseOrder=purchaseOrderService.createPurchaseOrder(project,this.user,company,null,supplierPartner.getCurrency(),this.today.plusDays(supplierPartner.getDeliveryDelay()),null,supplychainConfigService.getSupplychainConfig(company).getSalesOrderInvoicingTypeSelect(),location,this.today,PriceList.filter("String_Node_Str",supplierPartner).fetchOne(),supplierPartner).save();
        purchaseOrder.addPurchaseOrderLineListItem(purchaseOrderLineService.createPurchaseOrderLine(purchaseOrder,product,"String_Node_Str",null,minStockRules.getReOrderQty(),product.getUnit(),null));
        purchaseOrderService.computePurchaseOrder(purchaseOrder);
        purchaseOrder.save();
      }
    }
 else     if (minStockRules.getOrderAlertSelect() == IMinStockRules.ORDER_ALERT_PRODUCTION_ORDER) {
    }
 else     if (minStockRules.getOrderAlertSelect() == IMinStockRules.ORDER_ALERT_ALERT) {
    }
  }
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void generatePurchaseOrder(Product product,BigDecimal qty,LocationLine locationLine,Project project,int type) throws AxelorException {
  Location location=locationLine.getLocation();
  if (location == null) {
    return;
  }
  MinStockRules minStockRules=this.getMinStockRules(product,location,type);
  if (minStockRules == null) {
    return;
  }
  if (this.useMinStockRules(locationLine,minStockRules,qty,type)) {
    if (minStockRules.getOrderAlertSelect() == IMinStockRules.ORDER_ALERT_PURCHASE_ORDER) {
      Partner supplierPartner=product.getDefaultSupplierPartner();
      if (supplierPartner != null) {
        Company company=location.getCompany();
        PurchaseOrder purchaseOrder=purchaseOrderService.createPurchaseOrder(project,this.user,company,null,supplierPartner.getCurrency(),this.today.plusDays(supplierPartner.getDeliveryDelay()),null,supplychainConfigService.getSupplychainConfig(company).getSalesOrderInvoicingTypeSelect(),location,this.today,PriceList.filter("String_Node_Str",supplierPartner).fetchOne(),supplierPartner).save();
        purchaseOrder.addPurchaseOrderLineListItem(purchaseOrderLineService.createPurchaseOrderLine(purchaseOrder,product,"String_Node_Str",null,minStockRules.getReOrderQty(),product.getUnit(),null));
        purchaseOrderService.computePurchaseOrder(purchaseOrder);
        purchaseOrder.save();
      }
    }
 else     if (minStockRules.getOrderAlertSelect() == IMinStockRules.ORDER_ALERT_PRODUCTION_ORDER) {
    }
 else     if (minStockRules.getOrderAlertSelect() == IMinStockRules.ORDER_ALERT_ALERT) {
    }
  }
}