IDEMPIERE-6158 Warehouse Purchase Order cannot be completed after change of product (#2376)

* IDEMPIERE-6158 Warehouse Purchase Order cannot be completed after change of product

* - fix callouts to avoid setting M_Product_ID to null
This commit is contained in:
Carlos Ruiz 2024-05-23 16:47:26 +02:00
parent fb594a5f56
commit 6f4686f9db
7 changed files with 11 additions and 9 deletions

View File

@ -525,7 +525,7 @@ public class CalloutInOut extends CalloutEngine
mTab.setValue("M_Locator_ID", Integer.valueOf(M_Locator_ID));
}
else
mTab.setValue("M_AttributeSetInstance_ID", null);
mTab.setValue("M_AttributeSetInstance_ID", 0);
//
int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID");
boolean IsSOTrx = "Y".equals(Env.getContext(ctx, WindowNo, "IsSOTrx"));

View File

@ -60,7 +60,7 @@ public class CalloutInventory extends CalloutEngine
if ("M_Product_ID".equals(mField.getColumnName())) {
// product changed - remove old ASI
mTab.setValue("M_AttributeSetInstance_ID", null);
mTab.setValue("M_AttributeSetInstance_ID", 0);
}
// Get Book Value
@ -96,7 +96,7 @@ public class CalloutInventory extends CalloutEngine
if (M_AttributeSetInstance_ID != 0)
mTab.setValue(MInventoryLine.COLUMNNAME_M_AttributeSetInstance_ID, M_AttributeSetInstance_ID);
else
mTab.setValue(MInventoryLine.COLUMNNAME_M_AttributeSetInstance_ID, null);
mTab.setValue(MInventoryLine.COLUMNNAME_M_AttributeSetInstance_ID, 0);
}
// Set QtyBook from first storage location

View File

@ -325,7 +325,7 @@ public class CalloutInvoice extends CalloutEngine
&& Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID") != 0)
mTab.setValue("M_AttributeSetInstance_ID", Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID"));
else
mTab.setValue("M_AttributeSetInstance_ID", null);
mTab.setValue("M_AttributeSetInstance_ID", 0);
/***** Price Calculation see also qty ****/
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");

View File

@ -54,7 +54,7 @@ public class CalloutMovement extends CalloutEngine
&& Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID") != 0)
mTab.setValue("M_AttributeSetInstance_ID", Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID"));
else
mTab.setValue("M_AttributeSetInstance_ID", null);
mTab.setValue("M_AttributeSetInstance_ID", 0);
checkQtyAvailable(ctx, mTab, WindowNo, M_Product_ID, null);
return "";

View File

@ -759,7 +759,7 @@ public class CalloutOrder extends CalloutEngine
&& Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID") != 0)
mTab.setValue("M_AttributeSetInstance_ID", Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID"));
else
mTab.setValue("M_AttributeSetInstance_ID", null);
mTab.setValue("M_AttributeSetInstance_ID", 0);
/***** Price Calculation see also qty ****/
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");

View File

@ -55,7 +55,7 @@ public class CalloutProduction extends CalloutEngine
}
else
{
mTab.setValue("M_AttributeSetInstance_ID", null);
mTab.setValue("M_AttributeSetInstance_ID", 0);
}
MProduct product = MProduct.get(ctx, M_Product_ID);

View File

@ -808,8 +808,10 @@ public class MOrderLine extends X_C_OrderLine
// R/O Check - Product/Warehouse Change
if (!newRecord
&& (is_ValueChanged("M_Product_ID") || is_ValueChanged("M_Warehouse_ID") ||
(!getParent().isProcessed() && is_ValueChanged(COLUMNNAME_M_AttributeSetInstance_ID))))
&& ( is_ValueChanged("M_Product_ID")
|| is_ValueChanged("M_Warehouse_ID")
|| ( !getParent().isProcessed()
&& getM_AttributeSetInstance_ID() != get_ValueOldAsInt(COLUMNNAME_M_AttributeSetInstance_ID))))
{
if (!canChangeWarehouse())
return false;