use of org.compiere.model.MAcctSchemaGL in project adempiere by adempiere.
the class AcctSchemaCopyAcct method copyGL.
// doIt
/**
* Copy GL
* @param targetAS target
* @throws Exception
*/
private void copyGL(MAcctSchema targetAS) throws Exception {
MAcctSchemaGL source = MAcctSchemaGL.get(getCtx(), p_SourceAcctSchema_ID);
MAcctSchemaGL target = new MAcctSchemaGL(getCtx(), 0, get_TrxName());
target.setC_AcctSchema_ID(p_TargetAcctSchema_ID);
ArrayList<KeyNamePair> list = source.getAcctInfo();
for (int i = 0; i < list.size(); i++) {
KeyNamePair pp = list.get(i);
int sourceC_ValidCombination_ID = pp.getKey();
String columnName = pp.getName();
MAccount sourceAccount = MAccount.get(getCtx(), sourceC_ValidCombination_ID);
MAccount targetAccount = createAccount(targetAS, sourceAccount);
target.setValue(columnName, new Integer(targetAccount.getC_ValidCombination_ID()));
}
if (!target.save())
throw new AdempiereSystemError("Could not Save GL");
}
Aggregations