svn commit: r1749120 - /ofbiz/branches/release14.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1749120 - /ofbiz/branches/release14.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy

diveshdutta
Author: diveshdutta
Date: Sun Jun 19 01:18:26 2016
New Revision: 1749120

URL: http://svn.apache.org/viewvc?rev=1749120&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/release14.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy

Modified: ofbiz/branches/release14.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy?rev=1749120&r1=1749119&r2=1749120&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy (original)
+++ ofbiz/branches/release14.12/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy Sun Jun 19 01:18:26 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