From 2bcf6c577e6cd12186676e9ee62eda3106947cbd Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 4 Jul 2014 18:38:42 +0800 Subject: [PATCH 1/3] IDEMPIERE-2035 Generate Shipments is not adjusting QtyEntered. Accept patch from Alan Rodrigo Lescano. --- .../src/org/compiere/process/InOutGenerate.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java index 46e941005c..3e3c1d4d42 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java +++ b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java @@ -525,6 +525,10 @@ public class InOutGenerate extends SvrProcess MInOutLine line = new MInOutLine (m_shipment); line.setOrderLine(orderLine, 0, order.isSOTrx() ? toDeliver : Env.ZERO); line.setQty(toDeliver); + if (orderLine.getQtyEntered().compareTo(orderLine.getQtyOrdered()) != 0) + line.setQtyEntered(line.getMovementQty().multiply(orderLine.getQtyEntered()) + .divide(orderLine.getQtyOrdered(), 12, BigDecimal.ROUND_HALF_UP)); + line.setLine(m_line + orderLine.getLine()); if (!line.save()) throw new IllegalStateException("Could not create Shipment Line"); From f94deb552a15c9f9ee98678467d719bb5a2cf918 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 4 Jul 2014 18:41:27 +0800 Subject: [PATCH 2/3] IDEMPIERE-2004 WAccountDialog: Inconsistency between action_find and action_save. --- .../webui/window/WAccountDialog.java | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java index 9eaaa3bc2f..4261639da8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java @@ -442,7 +442,8 @@ public final class WAccountDialog extends Window // Finish m_query = new MQuery(); m_query.addRestriction("C_AcctSchema_ID", MQuery.EQUAL, m_C_AcctSchema_ID); - m_query.addRestriction("IsFullyQualified", MQuery.EQUAL, "Y"); + //action_save doesn't filter by IsFullyQualified +// m_query.addRestriction("IsFullyQualified", MQuery.EQUAL, "Y"); if (m_mAccount.C_ValidCombination_ID == 0) m_mTab.setQuery(MQuery.getEqualQuery("1", "2")); else @@ -676,7 +677,7 @@ public final class WAccountDialog extends Window else query = new MQuery(); // Alias - if (includeAliasCombination && f_Alias != null && f_Alias.getValue().toString().length() > 0) + if (includeAliasCombination && f_Alias != null && !isEmpty(f_Alias)) { String value = f_Alias.getValue().toString().toUpperCase(); if (!value.endsWith("%")) @@ -684,7 +685,7 @@ public final class WAccountDialog extends Window query.addRestriction("UPPER(Alias)", MQuery.LIKE, value); } // Combination (mandatory) - if (includeAliasCombination && f_Combination.getValue().toString().length() > 0) + if (includeAliasCombination && !isEmpty(f_Combination.getValue())) { String value = f_Combination.getValue().toString().toUpperCase(); if (!value.endsWith("%")) @@ -692,46 +693,46 @@ public final class WAccountDialog extends Window query.addRestriction("UPPER(Combination)", MQuery.LIKE, value); } // Org (mandatory) - if (f_AD_Org_ID != null && f_AD_Org_ID.getValue() != null) + if (f_AD_Org_ID != null && !isEmpty(f_AD_Org_ID.getValue())) query.addRestriction("AD_Org_ID", MQuery.EQUAL, f_AD_Org_ID.getValue()); // Account (mandatory) - if (f_Account_ID != null && f_Account_ID.getValue() != null) + if (f_Account_ID != null && !isEmpty(f_Account_ID.getValue())) query.addRestriction("Account_ID", MQuery.EQUAL, f_Account_ID.getValue()); - if (f_SubAcct_ID != null && f_SubAcct_ID.getValue() != null) + if (f_SubAcct_ID != null && !isEmpty(f_SubAcct_ID.getValue())) query.addRestriction("C_SubAcct_ID", MQuery.EQUAL, f_SubAcct_ID.getValue()); // Product - if (f_M_Product_ID != null && f_M_Product_ID.getValue() != null) + if (f_M_Product_ID != null && !isEmpty(f_M_Product_ID.getValue())) query.addRestriction("M_Product_ID", MQuery.EQUAL, f_M_Product_ID.getValue()); // BPartner - if (f_C_BPartner_ID != null && f_C_BPartner_ID.getValue() != null) + if (f_C_BPartner_ID != null && !isEmpty(f_C_BPartner_ID.getValue())) query.addRestriction("C_BPartner_ID", MQuery.EQUAL, f_C_BPartner_ID.getValue()); // Campaign - if (f_C_Campaign_ID != null && f_C_Campaign_ID.getValue() != null) + if (f_C_Campaign_ID != null && !isEmpty(f_C_Campaign_ID.getValue())) query.addRestriction("C_Campaign_ID", MQuery.EQUAL, f_C_Campaign_ID.getValue()); // Loc From - if (f_C_LocFrom_ID != null && f_C_LocFrom_ID.getValue() != null) + if (f_C_LocFrom_ID != null && !isEmpty(f_C_LocFrom_ID.getValue())) query.addRestriction("C_LocFrom_ID", MQuery.EQUAL, f_C_LocFrom_ID.getValue()); // Loc To - if (f_C_LocTo_ID != null && f_C_LocTo_ID.getValue() != null) + if (f_C_LocTo_ID != null && !isEmpty(f_C_LocTo_ID.getValue())) query.addRestriction("C_LocTo_ID", MQuery.EQUAL, f_C_LocTo_ID.getValue()); // Project - if (f_C_Project_ID != null && f_C_Project_ID.getValue() != null) + if (f_C_Project_ID != null && !isEmpty(f_C_Project_ID.getValue())) query.addRestriction("C_Project_ID", MQuery.EQUAL, f_C_Project_ID.getValue()); // SRegion - if (f_C_SalesRegion_ID != null && f_C_SalesRegion_ID.getValue() != null) + if (f_C_SalesRegion_ID != null && !isEmpty(f_C_SalesRegion_ID.getValue())) query.addRestriction("C_SalesRegion_ID", MQuery.EQUAL, f_C_SalesRegion_ID.getValue()); // Org Trx - if (f_AD_OrgTrx_ID != null && f_AD_OrgTrx_ID.getValue() != null) + if (f_AD_OrgTrx_ID != null && !isEmpty(f_AD_OrgTrx_ID.getValue())) query.addRestriction("AD_OrgTrx_ID", MQuery.EQUAL, f_AD_OrgTrx_ID.getValue()); // Activity - if (f_C_Activity_ID != null && f_C_Activity_ID.getValue() != null) + if (f_C_Activity_ID != null && !isEmpty(f_C_Activity_ID.getValue())) query.addRestriction("C_Activity_ID", MQuery.EQUAL, f_C_Activity_ID.getValue()); // User 1 - if (f_User1_ID != null && f_User1_ID.getValue() != null) + if (f_User1_ID != null && !isEmpty(f_User1_ID.getValue())) query.addRestriction("User1_ID", MQuery.EQUAL, f_User1_ID.getValue()); // User 2 - if (f_User2_ID != null && f_User2_ID.getValue() != null) + if (f_User2_ID != null && !isEmpty(f_User2_ID.getValue())) query.addRestriction("User2_ID", MQuery.EQUAL, f_User2_ID.getValue()); // Query From b08aebfab8425ea0301da8c5d8c7959f7b241491 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 4 Jul 2014 18:55:17 +0800 Subject: [PATCH 3/3] IDEMPIERE-2042 Don't reserved stock if c_orderline.qtyordered is -ve. --- org.adempiere.base/src/org/compiere/model/MInOut.java | 4 ++-- org.adempiere.base/src/org/compiere/model/MOrder.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index aa7b8e1c3d..c1eba072b0 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1407,7 +1407,7 @@ public class MInOut extends X_M_InOut implements DocAction m_processMsg = "Cannot correct Inventory OnHand (MA) [" + product.getValue() + "] - " + lastError; return DocAction.STATUS_Invalid; } - if (reservedDiff.signum() != 0) { + if (reservedDiff.signum() != 0 && oLine.getQtyOrdered().signum() > 0) { if (!MStorageReservation.add(getCtx(), reservationWarehouse_ID, sLine.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID, @@ -1460,7 +1460,7 @@ public class MInOut extends X_M_InOut implements DocAction m_processMsg = "Cannot correct Inventory OnHand [" + product.getValue() + "] - " + lastError; return DocAction.STATUS_Invalid; } - if (reservedDiff.signum() != 0) { + if (reservedDiff.signum() != 0 && oLine.getQtyOrdered().signum() > 0) { if (!MStorageReservation.add(getCtx(), reservationWarehouse_ID, sLine.getM_Product_ID(), sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID, diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index 2d89d4454f..d72e3eb1f7 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -1722,7 +1722,7 @@ public class MOrder extends X_C_Order implements DocAction BigDecimal difference = target .subtract(line.getQtyReserved()) .subtract(line.getQtyDelivered()); - if (difference.signum() == 0) + if (difference.signum() <= 0) { MProduct product = line.getProduct(); if (product != null)