MPPProductBOMLine: auto set Line if is zero

This commit is contained in:
teo_sarca 2008-10-07 15:29:27 +00:00
parent c1ceb57e34
commit 1493f5b8ac
1 changed files with 16 additions and 5 deletions

View File

@ -100,11 +100,22 @@ public class MPPProductBOMLine extends X_PP_Product_BOMLine
return new ProductLowLevelCalculator(ctx, trxName).getLowLevel(M_Product_ID); return new ProductLowLevelCalculator(ctx, trxName).getLowLevel(M_Product_ID);
} }
/**************************************************************************
* After Save @Override
* @param newRecord new protected boolean beforeSave(boolean newRecord)
* @return save {
*/ if (getLine() <= 0)
{
final String sql = "SELECT COALESCE(MAX("+COLUMNNAME_Line+"),0) + 10 FROM "+Table_Name
+" WHERE "+COLUMNNAME_PP_Product_BOM_ID+"=?";
int line = DB.getSQLValue(get_TrxName(), sql, getPP_Product_BOM_ID());
setLine(line);
}
return true;
}
@Override
protected boolean afterSave(boolean newRecord, boolean success) protected boolean afterSave(boolean newRecord, boolean success)
{ {
if (success) if (success)