diff --git a/migration/iD11/oracle/202404171125_IDEMPIERE-6110.sql b/migration/iD11/oracle/202404171125_IDEMPIERE-6110.sql new file mode 100644 index 0000000000..dbeb7bfc22 --- /dev/null +++ b/migration/iD11/oracle/202404171125_IDEMPIERE-6110.sql @@ -0,0 +1,10 @@ +-- IDEMPIERE-6110 +SELECT register_migration_script('202404171125_IDEMPIERE-6110.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Apr 17, 2024, 11:25:53 AM BRT +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Products or charges configured as ''Freight Product'' or ''Freight Charge'' cannot be added to this order due to the combination of delivery via rule and freight cost rule',0,0,'Y',TO_TIMESTAMP('2024-04-17 11:25:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-04-17 11:25:53','YYYY-MM-DD HH24:MI:SS'),100,nextidfunc(9,'N'),'FreightOrderLineNotAllowed','D','204c8bb9-d002-4beb-bbc3-1d1a11d7471d') +; + diff --git a/migration/iD11/postgresql/202404171125_IDEMPIERE-6110.sql b/migration/iD11/postgresql/202404171125_IDEMPIERE-6110.sql new file mode 100644 index 0000000000..387e855eca --- /dev/null +++ b/migration/iD11/postgresql/202404171125_IDEMPIERE-6110.sql @@ -0,0 +1,7 @@ +-- IDEMPIERE-6110 +SELECT register_migration_script('202404171125_IDEMPIERE-6110.sql') FROM dual; + +-- Apr 17, 2024, 11:25:53 AM BRT +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Products or charges configured as ''Freight Product'' or ''Freight Charge'' cannot be added to this order due to the combination of delivery via rule and freight cost rule',0,0,'Y',TO_TIMESTAMP('2024-04-17 11:25:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-04-17 11:25:53','YYYY-MM-DD HH24:MI:SS'),100,nextidfunc(9,'N'),'FreightOrderLineNotAllowed','D','204c8bb9-d002-4beb-bbc3-1d1a11d7471d') +; + diff --git a/org.adempiere.base/src/org/compiere/model/MOrderLine.java b/org.adempiere.base/src/org/compiere/model/MOrderLine.java index e2f8a1e097..0999811023 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrderLine.java +++ b/org.adempiere.base/src/org/compiere/model/MOrderLine.java @@ -906,6 +906,16 @@ public class MOrderLine extends X_C_OrderLine } } + MClientInfo ci = MClientInfo.get(getCtx(), getAD_Client_ID(), get_TrxName()); + if (MOrder.DELIVERYVIARULE_Shipper.equals(getParent().getDeliveryViaRule()) && MOrder.FREIGHTCOSTRULE_FreightIncluded.equals(getParent().getFreightCostRule()) + && ( (getM_Product_ID() > 0 && getM_Product_ID() == ci.getM_ProductFreight_ID()) + || (getC_Charge_ID() > 0 && getC_Charge_ID() == ci.getC_ChargeFreight_ID()) + ) + ) { + log.saveError("Error", Msg.getMsg(getCtx(), "FreightOrderLineNotAllowed")); + return false; + } + return true; } // beforeSave