IDEMPIERE-1750:Restore M_ProductionPlan backward compatibility

This commit is contained in:
hieplq 2016-02-03 14:09:06 +07:00
parent d37e7661fe
commit 8b7c5413e3
1 changed files with 9 additions and 2 deletions

View File

@ -84,7 +84,7 @@ public class Doc_Production extends Doc
+ " M_ProductionLine pro_line INNER JOIN M_ProductionPlan plan ON pro_line.M_ProductionPlan_id = plan.M_ProductionPlan_id "
+ " INNER JOIN M_Production pro ON pro.M_Production_id = plan.M_Production_id "
+ " WHERE pro.M_Production_ID=? "
+ " ORDER BY pro_line.Line";
+ " ORDER BY plan.M_ProductionPlan_id, pro_line.Line";
}else{
// Production
// -- ProductionLine - the real level
@ -164,6 +164,7 @@ public class Doc_Production extends Doc
// Line pointer
FactLine fl = null;
X_M_Production prod = (X_M_Production)getPO();
for (int i = 0; i < p_lines.length; i++)
{
DocLine line = p_lines[i];
@ -181,12 +182,18 @@ public class Doc_Production extends Doc
}
if (line.isProductionBOM())
{
X_M_ProductionLine endProLine = (X_M_ProductionLine)line.getPO();
Object parentEndPro = prod.isUseProductionPlan()?endProLine.getM_ProductionPlan_ID():endProLine.getM_Production_ID();
// Get BOM Cost - Sum of individual lines
BigDecimal bomCost = Env.ZERO;
for (int ii = 0; ii < p_lines.length; ii++)
{
DocLine line0 = p_lines[ii];
if (line0.getM_Production_ID() != line.getM_Production_ID())
X_M_ProductionLine bomProLine = (X_M_ProductionLine)line0.getPO();
Object parentBomPro = prod.isUseProductionPlan()?bomProLine.getM_ProductionPlan_ID():bomProLine.getM_Production_ID();
if (!parentBomPro.equals(parentEndPro))
continue;
//pb changed this 20/10/06
if (!line0.isProductionBOM())