diff --git a/src/org/openbravo/retail/posterminal/PaidReceiptLinesProperties.java b/src/org/openbravo/retail/posterminal/PaidReceiptLinesProperties.java
--- a/src/org/openbravo/retail/posterminal/PaidReceiptLinesProperties.java
+++ b/src/org/openbravo/retail/posterminal/PaidReceiptLinesProperties.java
@@ -42,6 +42,10 @@
         add(new HQLProperty("ordLine.salesOrder.currency.pricePrecision", "pricePrecision"));
         add(new HQLProperty("ordLine.warehouse.id", "warehouse"));
         add(new HQLProperty("ordLine.warehouse.name", "warehousename"));
+        // Only used for returns
+        add(new HQLProperty(
+            "(ordLine.deliveredQuantity - (select coalesce(abs(sum(deliveredQuantity)),0) from OrderLine where goodsShipmentLine.salesOrderLine.id =ordLine.id))",
+            "remainingQuantity"));
       }
     };
 
diff --git a/src/org/openbravo/retail/posterminal/PaidReceiptShipLinesProperties.java b/src/org/openbravo/retail/posterminal/PaidReceiptShipLinesProperties.java
new file mode 100644
--- /dev/null
+++ b/src/org/openbravo/retail/posterminal/PaidReceiptShipLinesProperties.java
@@ -0,0 +1,46 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2014 Openbravo S.L.U.
+ * Licensed under the Openbravo Commercial License version 1.0
+ * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
+ * or in the legal folder of this module distribution.
+ ************************************************************************************
+ */
+
+package org.openbravo.retail.posterminal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openbravo.client.kernel.ComponentProvider.Qualifier;
+import org.openbravo.mobile.core.model.HQLProperty;
+import org.openbravo.mobile.core.model.ModelExtension;
+
+/**
+ * Defines hql properties for the PaidReceipsShipLines Order
+ * 
+ * @author mdj
+ * 
+ */
+
+@Qualifier(PaidReceipts.paidReceiptsShipLinesPropertyExtension)
+public class PaidReceiptShipLinesProperties extends ModelExtension {
+
+  @Override
+  public List<HQLProperty> getHQLProperties(Object params) {
+    ArrayList<HQLProperty> list = new ArrayList<HQLProperty>() {
+      private static final long serialVersionUID = 1L;
+      {
+        add(new HQLProperty("id", "shipLineId"));
+        add(new HQLProperty("shipmentReceipt.documentNo", "shipment"));
+        add(new HQLProperty("lineNo", "shipmentlineNo"));
+        add(new HQLProperty("movementQuantity", "qty"));
+        add(new HQLProperty(
+            "movementQuantity - (select coalesce(sum(abs(deliveredQuantity)),0) from OrderLine where goodsShipmentLine.id = m.id)",
+            "remainingQty"));
+      }
+    };
+
+    return list;
+  }
+}
diff --git a/src/org/openbravo/retail/posterminal/PaidReceipts.java b/src/org/openbravo/retail/posterminal/PaidReceipts.java
--- a/src/org/openbravo/retail/posterminal/PaidReceipts.java
+++ b/src/org/openbravo/retail/posterminal/PaidReceipts.java
@@ -32,12 +32,12 @@
 import org.openbravo.mobile.core.model.ModelExtension;
 import org.openbravo.mobile.core.model.ModelExtensionUtils;
 import org.openbravo.model.common.order.OrderLineOffer;
-import org.openbravo.model.materialmgmt.transaction.ShipmentInOutLine;
 import org.openbravo.service.json.JsonConstants;
 
 public class PaidReceipts extends JSONProcessSimple {
   public static final String paidReceiptsPropertyExtension = "PRExtension";
   public static final String paidReceiptsLinesPropertyExtension = "PRExtensionLines";
+  public static final String paidReceiptsShipLinesPropertyExtension = "PRExtensionShipLines";
 
   @Inject
   @Any
@@ -47,6 +47,10 @@
   @Any
   @Qualifier(paidReceiptsLinesPropertyExtension)
   private Instance<ModelExtension> extensionsLines;
+  @Inject
+  @Any
+  @Qualifier(paidReceiptsShipLinesPropertyExtension)
+  private Instance<ModelExtension> extensionsShipLines;
 
   @Override
   public JSONObject exec(JSONObject jsonsent) throws JSONException, ServletException {
@@ -87,8 +91,14 @@
             .getPropertyExtensions(extensionsLines);
         String hqlPaidReceiptsLines = "select " + hqlPropertiesLines.getHqlSelect() + //
             "  from OrderLine as ordLine " + //
-            " where ordLine.salesOrder.id=? " + //
-            " order by ordLine.lineNo";
+            " where ordLine.salesOrder.id=? "; //
+
+        // get returns
+        if (jsonsent.has("forReturn") && jsonsent.getBoolean("forReturn")) {
+          hqlPaidReceiptsLines += "and ordLine.deliveredQuantity > (select coalesce(abs(sum(deliveredQuantity)),0) from OrderLine where goodsShipmentLine.salesOrderLine.id =ordLine.id)";
+        }
+
+        hqlPaidReceiptsLines += " order by ordLine.lineNo";
         Query paidReceiptsLinesQuery = OBDal.getInstance().getSession()
             .createQuery(hqlPaidReceiptsLines);
         paidReceiptsLinesQuery.setString(0, orderid);
@@ -107,21 +117,31 @@
 
           // get shipmentLines for returns
           if (jsonsent.has("forReturn") && jsonsent.getBoolean("forReturn")) {
-            OBCriteria<ShipmentInOutLine> shipLinesCri = OBDal.getInstance().createCriteria(
-                ShipmentInOutLine.class);
-            shipLinesCri.add(Restrictions.eq(ShipmentInOutLine.PROPERTY_SALESORDERLINE + ".id",
-                (String) objpaidReceiptsLines[6]));
-            shipLinesCri.addOrder(Order.asc(ShipmentInOutLine.PROPERTY_LINENO));
+            HQLPropertyList hqlPropertiesShipLines = ModelExtensionUtils
+                .getPropertyExtensions(extensionsShipLines);
+            String hqlPaidReceiptsShipLines = "select "
+                + hqlPropertiesShipLines.getHqlSelect() //
+                + " from MaterialMgmtShipmentInOutLine as m where salesOrderLine.id= ? "
+                + " and movementQuantity > (select coalesce(sum(abs(deliveredQuantity)),0) from OrderLine where goodsShipmentLine.id = m.id)";
+            OBDal.getInstance().getSession().createQuery(hqlPaidReceiptsShipLines);
+            Query paidReceiptsShipLinesQuery = OBDal.getInstance().getSession()
+                .createQuery(hqlPaidReceiptsShipLines);
+            paidReceiptsShipLinesQuery.setString(0, (String) objpaidReceiptsLines[6]);
+
+            // cycle through the lines of the selected order
             JSONArray shipmentlines = new JSONArray();
-            for (ShipmentInOutLine shipline : shipLinesCri.list()) {
+            for (Object objShipLines : paidReceiptsShipLinesQuery.list()) {
+
               JSONObject jsonShipline = new JSONObject();
-              jsonShipline.put("shipLineId", shipline.getId());
-              jsonShipline.put("shipment", shipline.getShipmentReceipt().getDocumentNo());
-              jsonShipline.put("shipmentlineNo", shipline.getLineNo());
-              jsonShipline.put("qty", shipline.getMovementQuantity());
+              Object[] objpaidReceiptsShipLines = (Object[]) objShipLines;
+              jsonShipline.put("shipLineId", objpaidReceiptsShipLines[0]);
+              jsonShipline.put("shipment", objpaidReceiptsShipLines[1]);
+              jsonShipline.put("shipmentlineNo", objpaidReceiptsShipLines[2]);
+              jsonShipline.put("qty", objpaidReceiptsShipLines[3]);
+              jsonShipline.put("remainingQty", objpaidReceiptsShipLines[4]);
               shipmentlines.put(jsonShipline);
-              paidReceiptLine.put("shipmentlines", shipmentlines);
             }
+            paidReceiptLine.put("shipmentlines", shipmentlines);
           }
 
           // promotions per line
diff --git a/src/org/openbravo/retail/posterminal/PaidReceiptsHeader.java b/src/org/openbravo/retail/posterminal/PaidReceiptsHeader.java
--- a/src/org/openbravo/retail/posterminal/PaidReceiptsHeader.java
+++ b/src/org/openbravo/retail/posterminal/PaidReceiptsHeader.java
@@ -75,7 +75,7 @@
       hqlPaidReceipts += " and (select sum(deliveredQuantity) from ord.orderLineList where orderedQuantity > 0)=0 and ord.documentStatus = 'CO' ";
     } else if (json.getBoolean("isReturn")) {
       // (It is not Layaway and It is not a Return)
-      hqlPaidReceipts += " and ((select count(deliveredQuantity) from ord.orderLineList where deliveredQuantity != 0) > 0 and (select count(orderedQuantity) from ord.orderLineList where orderedQuantity > 0) > 0) ";
+      hqlPaidReceipts += " and ((select count(deliveredQuantity) from ord.orderLineList where deliveredQuantity != 0) > 0 and (select count(id) from OrderLine as line  where line.salesOrder=ord and line.deliveredQuantity > (select coalesce(abs(sum(deliveredQuantity)),0) from OrderLine where goodsShipmentLine.salesOrderLine.id =line.id)) > 0)";
     } else {
       // (It is not Layaway or it is a Return)
       hqlPaidReceipts += " and exists(select 1 from ord.orderLineList where deliveredQuantity != 0) ";
