From 0ae352c8154da527fcb5a5fe67ce2dbdd17d3068 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 22 Nov 2017 15:49:11 +0800 Subject: [PATCH] IDEMPIERE-3406 MStorageOnHand.getDateMaterialPolicy isn't correct on some condition --- org.adempiere.base/src/org/compiere/model/MStorageOnHand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java index 46e40e675c..73708233ee 100644 --- a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java +++ b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java @@ -1043,7 +1043,7 @@ public class MStorageOnHand extends X_M_StorageOnHand if (M_Product_ID <= 0 || M_AttributeSetInstance_ID <= 0) return null; - String sql = "SELECT dateMaterialPolicy FROM M_StorageOnHand WHERE M_Product_ID=? and M_AttributeSetInstance_ID=?"; + String sql = "SELECT dateMaterialPolicy FROM M_StorageOnHand WHERE M_Product_ID=? and M_AttributeSetInstance_ID=? ORDER BY QtyOnHand DESC"; PreparedStatement pstmt = null; ResultSet rs = null; @@ -1085,7 +1085,7 @@ public class MStorageOnHand extends X_M_StorageOnHand if (M_Product_ID <= 0 || M_AttributeSetInstance_ID <= 0) return null; - String sql = "SELECT dateMaterialPolicy FROM M_StorageOnHand WHERE M_Product_ID=? and M_AttributeSetInstance_ID=? AND M_Locator_ID=?"; + String sql = "SELECT dateMaterialPolicy FROM M_StorageOnHand WHERE M_Product_ID=? and M_AttributeSetInstance_ID=? AND M_Locator_ID=? ORDER BY QtyOnHand DESC"; PreparedStatement pstmt = null; ResultSet rs = null;