MPPProductBOMLine: auto set Line if is zero
This commit is contained in:
parent
c1ceb57e34
commit
1493f5b8ac
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue