--- a/modules/org.openbravo.retail.posterminal/src/org/openbravo/retail/posterminal/process/IssueSalesOrderLines.java	2024-01-19 12:32:53.271300000 +0100
+++ b/modules/org.openbravo.retail.posterminal/src/org/openbravo/retail/posterminal/process/IssueSalesOrderLines.java	2024-01-19 13:20:23.250272000 +0100
@@ -42,6 +42,7 @@
 import org.openbravo.model.common.order.OrderLine;
 import org.openbravo.model.common.plm.Product;
 import org.openbravo.model.materialmgmt.transaction.ShipmentInOut;
+import org.openbravo.model.materialmgmt.transaction.ShipmentInOutLine;
 import org.openbravo.retail.posterminal.InvoiceShipmentHook;
 import org.openbravo.retail.posterminal.JSONProcessSimple;
 import org.openbravo.service.json.JsonConstants;
@@ -77,6 +78,8 @@
             .getInstanceFromStaticBeanManager(GoodsShipmentGenerator.class);
         ShipmentInOut shipment = createNewShipment(orderFromJson);
 
+        addExplodeLines(orderFromJson.getString("order"), linesFromJson);
+
         addLinesForIndependentService(orderFromJson.getString("order"), linesFromJson);
 
         Set<String> orders = new HashSet<>();
@@ -90,6 +93,7 @@
         OBDal.getInstance().flush(); // Persists the shipment document in order to be ready for
                                      // further processing
         ServiceDeliverUtility.deliverServices(shipment);
+        checkExplodeLines(shipment);
         shipmentGenerator.processShipment();
         final Invoice invoice = shipmentGenerator.invoiceShipmentIfPossible(orderFromJson);
 
@@ -130,6 +134,46 @@
     return jsonResponse;
   }
 
+  private void checkExplodeLines(ShipmentInOut shipment) {
+    for (ShipmentInOutLine shipmentLine : shipment.getMaterialMgmtShipmentInOutLineList()) {
+      shipmentLine = OBDal.getInstance().get(ShipmentInOutLine.class, shipmentLine.getId());
+      shipmentLine.setExplode(shipmentLine.getSalesOrderLine().isExplode());
+    }
+
+  }
+
+  private void addExplodeLines(String orderId, JSONArray linesFromJson) throws JSONException {
+    for (int j = 0; j < linesFromJson.length(); j++) {
+      JSONObject jsonLine = linesFromJson.getJSONObject(j);
+      BigDecimal qtyToDeliver = new BigDecimal(jsonLine.getString("toPrepare"));
+
+      OBQuery<OrderLine> productQuery = OBDal.getInstance()
+          .createQuery(OrderLine.class, " e where e.bOMParent.id=:orderLineId");
+      productQuery.setNamedParameter("orderLineId", jsonLine.getString("lineId"));
+      List<OrderLine> productList = productQuery.list();
+      if (productList.size() > 0) {
+        for (OrderLine orderLine : productList) {
+          boolean hasPendingDelivery = true;
+          if (!orderLine.getOrderedQuantity()
+              .equals(orderLine.getDeliveredQuantity().add(qtyToDeliver))) {
+            hasPendingDelivery = false;
+          }
+
+          if (hasPendingDelivery) {
+            JSONObject json = new JSONObject();
+            json.put("lineId", orderLine.getId());
+            json.put("orderId", orderLine.getSalesOrder().getId());
+            json.put("productId", orderLine.getProduct().getId());
+            json.put("qtyOrdered", orderLine.getOrderedQuantity());
+            json.put("qtyDelivered", orderLine.getDeliveredQuantity());
+            json.put("toPrepare", qtyToDeliver);
+            linesFromJson.put(json);
+          }
+        }
+      }
+    }
+  }
+
   private ShipmentInOut createNewShipment(final JSONObject orderFromJson) throws JSONException {
     Organization organization = OBDal.getInstance()
         .getProxy(Organization.class, orderFromJson.getString("organizationId"));
