IDEMPIERE-6110 New Error Message (#2318)

* IDEMPIERE-6110 New Error Message

* IDEMPIERE-6110 - Added script in iD11

* IDEMPIERE - 6110 Change validation to beforeSave

* IDEMPIERE-6110 Improve messsage

* IDEMPIERE-6110 - Adjust message
This commit is contained in:
Vitor Henrique Dos Santos 2024-04-19 08:57:54 -03:00 committed by Carlos Ruiz
parent 0aa862e105
commit e4e27f4ee5
3 changed files with 27 additions and 0 deletions

View File

@ -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')
;

View File

@ -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')
;

View File

@ -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