IDEMPIERE-3170 Return to Vendor propagate wrong cost amount to Organization accounting schema denoted in different currency

This commit is contained in:
Heng Sin Low 2016-09-12 18:10:33 +08:00
parent 5b29241d87
commit 6a7b6807ce
1 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import java.util.logging.Level;
import org.compiere.model.I_M_InOutLine;
import org.compiere.model.I_M_RMALine;
import org.compiere.model.MConversionRate;
import org.compiere.model.MOrderLandedCostAllocation;
import org.compiere.model.MTax;
import org.compiere.model.MCurrency;
@ -624,6 +625,15 @@ public class Doc_InOut extends Doc
costs = costs.subtract(costTax);
}
} // correct included Tax
// different currency
if (C_Currency_ID != originalOrderLine.getC_Currency_ID())
{
costs = MConversionRate.convert (getCtx(),
costs, originalOrderLine.getC_Currency_ID(), C_Currency_ID,
getDateAcct(), 0, getAD_Client_ID(), getAD_Org_ID(), true);
}
costs = costs.multiply(line.getQty());
costs = costs.negate();
}