From d2daebe6d3663f4a2bda7ce78b55838b68b5bd7e Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Tue, 9 Dec 2008 21:03:35 +0000 Subject: [PATCH] BF [ 2227901 ] MRP (Calculate Material Plan) fails if resource is empty https://sourceforge.net/tracker/index.php?func=detail&aid=2227901&group_id=176962&atid=879332 --- base/src/org/compiere/model/MResource.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/base/src/org/compiere/model/MResource.java b/base/src/org/compiere/model/MResource.java index 2a7e94be48..75c1ae04f3 100644 --- a/base/src/org/compiere/model/MResource.java +++ b/base/src/org/compiere/model/MResource.java @@ -19,6 +19,7 @@ package org.compiere.model; import java.sql.ResultSet; import java.util.Properties; +import org.adempiere.exceptions.AdempiereException; import org.compiere.util.CCache; @@ -30,6 +31,7 @@ import org.compiere.util.CCache; * * @author Teo Sarca, www.arhipac.ro *
  • FR [ 2051056 ] MResource[Type] should be cached + *
  • BF [ 2227901 ] MRP (Calculate Material Plan) fails if resource is empty */ public class MResource extends X_S_Resource { @@ -130,6 +132,14 @@ public class MResource extends X_S_Resource m_product = new MProduct(this, getResourceType()); m_product.saveEx(get_TrxName()); } + // + // Validate Manufacturing Resource + if (isManufacturingResource() + && MANUFACTURINGRESOURCETYPE_Plant.equals(getManufacturingResourceType()) + && getPlanningHorizon() <= 0) + { + throw new AdempiereException("@"+COLUMNNAME_PlanningHorizon+"@ <= @0@ !"); + } return true; } // beforeSave