// Get the list of shipments which are associated with the filtered purchase orders
if (! UtilValidate.isEmpty(invoiceablePrimaryOrderIds)) {
List invoiceableShipmentConds = UtilMisc.toList(
EntityCondition.makeCondition("primaryOrderId", EntityOperator.IN, invoiceablePrimaryOrderIds),
EntityCondition.makeCondition("shipmentId", EntityOperator.IN, shipmentIds));
invoiceableShipments = delegator.findList("Shipment", EntityCondition.makeCondition(invoiceableShipmentConds, EntityOperator.AND), null, null, null, false);
}
} else {
List invoiceableShipmentIds = EntityUtil.getFieldListFromEntityList(toBillItems, "shipmentId", true);
if (UtilValidate.isNotEmpty(invoiceableShipmentIds)) {
invoiceableShipments = delegator.findList("Shipment", EntityCondition.makeCondition("shipmentId", EntityOperator.IN, invoiceableShipmentIds), null, null, null, false);