Program: 59197
Project: 59197
Buggy source:
@Transactional public Inventory createInventory(String ref,LocalDate date,String description,Location location,boolean excludeOutOfStock,boolean includeObsolete,ProductFamily productFamily,ProductCategory productCategory) throws Exception {
  Inventory inventory=new Inventory();
  inventory.setStatusSelect(1);
  if (ref != null)   inventory.setInventorySeq(ref);
  if (date != null)   inventory.setDateT(date.toDateTimeAtStartOfDay());
 else   throw new Exception("String_Node_Str");
  if (description != null)   inventory.setDescription(description);
  if (location != null)   inventory.setLocation(location);
 else   throw new Exception("String_Node_Str");
  String query="String_Node_Str";
  List<Object> params=new ArrayList<Object>();
  params.add(location);
  if (excludeOutOfStock) {
    query+="String_Node_Str";
  }
  if (!includeObsolete) {
    query+="String_Node_Str";
    params.add(date);
  }
  if (productFamily != null) {
    query+="String_Node_Str";
    params.add(productFamily);
  }
  if (productCategory != null) {
    query+="String_Node_Str";
    params.add(productCategory);
  }
  List<LocationLine> locationLineList=LocationLine.all().filter(query,params.toArray()).fetch();
  if (locationLineList != null) {
    List<InventoryLine> inventoryLineList=new ArrayList<InventoryLine>();
    for (    LocationLine locationLine : locationLineList) {
      InventoryLine inventoryLine=new InventoryLine();
      inventoryLine.setProduct(locationLine.getProduct());
      inventoryLine.setCurrentQty(locationLine.getCurrentQty());
      inventoryLine.setInventory(inventory);
      inventoryLine.setTrackingNumber(locationLine.getTrackingNumber());
      inventoryLine.setProductVariant(locationLine.getProductVariant());
      inventoryLineList.add(inventoryLine);
    }
    inventory.setInventoryLineList(inventoryLineList);
  }
  inventory.save();
  return inventory;
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Inventory createInventory(String ref,LocalDate date,String description,Location location,boolean excludeOutOfStock,boolean includeObsolete,ProductFamily productFamily,ProductCategory productCategory) throws Exception {
  Inventory inventory=new Inventory();
  inventory.setStatusSelect(1);
  if (ref != null)   inventory.setInventorySeq(ref);
  if (date != null)   inventory.setDateT(date.toDateTimeAtStartOfDay());
 else   throw new Exception("String_Node_Str");
  if (description != null)   inventory.setDescription(description);
  if (location != null)   inventory.setLocation(location);
 else   throw new Exception("String_Node_Str");
  String query="String_Node_Str";
  List<Object> params=new ArrayList<Object>();
  params.add(location);
  if (excludeOutOfStock) {
    query+="String_Node_Str";
  }
  if (!includeObsolete) {
    query+="String_Node_Str";
    params.add(date);
  }
  if (productFamily != null) {
    query+="String_Node_Str";
    params.add(productFamily);
  }
  if (productCategory != null) {
    query+="String_Node_Str";
    params.add(productCategory);
  }
  List<LocationLine> locationLineList=LocationLine.all().filter(query,params.toArray()).fetch();
  if (locationLineList != null) {
    List<InventoryLine> inventoryLineList=new ArrayList<InventoryLine>();
    for (    LocationLine locationLine : locationLineList) {
      InventoryLine inventoryLine=new InventoryLine();
      inventoryLine.setProduct(locationLine.getProduct());
      inventoryLine.setCurrentQty(locationLine.getCurrentQty());
      inventoryLine.setInventory(inventory);
      inventoryLine.setTrackingNumber(locationLine.getTrackingNumber());
      inventoryLine.setProductVariant(locationLine.getProductVariant());
      inventoryLineList.add(inventoryLine);
    }
    inventory.setInventoryLineList(inventoryLineList);
  }
  inventory.save();
  return inventory;
}