Author: diveshdutta
Date: Sun Jun 19 01:16:43 2016
New Revision: 1749119

URL: http://svn.apache.org/viewvc?rev=1749119&view=rev
Log:
[OFBIZ-7106] Fixed: Pop up to show the existing inventory againt Purchase 
Return shipments is showing Zero ATP inventory against the Product need to be 
returned. Thanks Ankush Upadhyay for the patch and Swapnil Shah for reporting 
the issue.

Modified:
    
ofbiz/branches/release15.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy

Modified: 
ofbiz/branches/release15.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release15.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy?rev=1749119&r1=1749118&r2=1749119&view=diff
==============================================================================
--- 
ofbiz/branches/release15.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
 (original)
+++ 
ofbiz/branches/release15.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
 Sun Jun 19 01:16:43 2016
@@ -16,7 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityOperator;
 orderId = parameters.orderId;
 partyId = parameters.partyId;
 productId = parameters.productId;
@@ -26,12 +27,14 @@ if (orderId && productId) {
     context.inventoryItemsForPo = shipmentReceiptAndItems;
     context.orderId = orderId;
 }
-
+exprList = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, 
productId),
+               EntityCondition.makeCondition("availableToPromiseTotal", 
EntityOperator.GREATER_THAN, BigDecimal.ZERO)];
 if (partyId && productId) {
     orderRoles = from("OrderRole").where("partyId", partyId, "roleTypeId", 
"BILL_FROM_VENDOR").queryList();
     inventoryItemsForSupplier = [];
     orderRoles.each { orderRole ->
-        shipmentReceiptAndItems = 
from("ShipmentReceiptAndItem").where("productId", productId, "orderId", 
orderRole.orderId).queryList();
+        shipmentReceiptAndItems = 
from("ShipmentReceiptAndItem").where(EntityCondition.makeCondition(exprList, 
EntityOperator.AND),
+                       EntityCondition.makeCondition("orderId", 
EntityOperator.EQUALS, orderRole.orderId)).queryList();
         inventoryItemsForSupplier.addAll(shipmentReceiptAndItems);
     }
     context.inventoryItemsForSupplier = inventoryItemsForSupplier;
@@ -39,9 +42,9 @@ if (partyId && productId) {
 }
 
 if (productId) {
-    inventoryItems = from("InventoryItem").where("productId", 
productId).queryList();
+    inventoryItems = 
from("InventoryItem").where(EntityCondition.makeCondition(exprList, 
EntityOperator.AND)).queryList();
     context.inventoryItemsForProduct = inventoryItems;
     context.productId = productId;
     product = from("Product").where("productId", productId).queryOne();
     context.internalName = product.internalName;
-}
+}
\ No newline at end of file


Reply via email to