Author: diveshdutta
Date: Sun Jun 19 01:15:34 2016
New Revision: 1749118
URL: http://svn.apache.org/viewvc?rev=1749118&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/trunk/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy
Modified:
ofbiz/trunk/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy?rev=1749118&r1=1749117&r2=1749118&view=diff
==============================================================================
---
ofbiz/trunk/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy
(original)
+++
ofbiz/trunk/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy
Sun Jun 19 01:15:34 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