IDEMPIERE-5153 Cost Adjument Line Before Save: Update current cost price (#1411)

- Fix always getting current cost from primary accounting schema.
This commit is contained in:
hengsin 2022-07-26 21:26:58 +08:00 committed by GitHub
parent 486ae19cdc
commit edc96cca12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -369,6 +369,20 @@ public class MInventoryLine extends X_M_InventoryLine
} }
} }
//check currency and as
int C_Currency_ID = getParent().getC_Currency_ID();
if (as.getC_Currency_ID() != C_Currency_ID)
{
MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(getCtx(), client.get_ID());
for (int i = 0; i < ass.length ; i ++)
{
MAcctSchema a = ass[i];
if (a.getC_Currency_ID() == C_Currency_ID)
as = a ;
}
}
String costingMethod = getParent().getCostingMethod(); String costingMethod = getParent().getCostingMethod();
int AD_Org_ID = getAD_Org_ID(); int AD_Org_ID = getAD_Org_ID();
MCost cost = product.getCostingRecord(as, AD_Org_ID, M_ASI_ID, costingMethod); MCost cost = product.getCostingRecord(as, AD_Org_ID, M_ASI_ID, costingMethod);