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
This commit is contained in:
teo_sarca 2008-12-09 21:03:35 +00:00
parent e2dfc86d19
commit d2daebe6d3
1 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package org.compiere.model;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.util.Properties; import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.util.CCache; import org.compiere.util.CCache;
@ -30,6 +31,7 @@ import org.compiere.util.CCache;
* *
* @author Teo Sarca, www.arhipac.ro * @author Teo Sarca, www.arhipac.ro
* <li>FR [ 2051056 ] MResource[Type] should be cached * <li>FR [ 2051056 ] MResource[Type] should be cached
* <li>BF [ 2227901 ] MRP (Calculate Material Plan) fails if resource is empty
*/ */
public class MResource extends X_S_Resource 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 = new MProduct(this, getResourceType());
m_product.saveEx(get_TrxName()); m_product.saveEx(get_TrxName());
} }
//
// Validate Manufacturing Resource
if (isManufacturingResource()
&& MANUFACTURINGRESOURCETYPE_Plant.equals(getManufacturingResourceType())
&& getPlanningHorizon() <= 0)
{
throw new AdempiereException("@"+COLUMNNAME_PlanningHorizon+"@ <= @0@ !");
}
return true; return true;
} // beforeSave } // beforeSave