use of org.compiere.impexp.ImpFormat in project adempiere by adempiere.
the class MSetup method importChart.
public boolean importChart(File chart) {
// import chart of accounts automatically
ImpFormat importer = ImpFormat.load("Accounting - Accounts");
importer.loadFile(m_ctx, chart, m_trx.getTrxName(), m_client.getAD_Client_ID(), 0, true);
// Process
// Import_Account
MProcess process = MProcess.get(m_ctx, 197);
MPInstance pInstance = new MPInstance(process, 0);
pInstance.setAD_Client_ID(m_client.getAD_Client_ID());
pInstance.setAD_Org_ID(0);
for (MPInstancePara para : pInstance.getParameters()) {
String name = para.getParameterName();
if ("AD_Client_ID".equals(name))
para.setP_Number(m_client.getAD_Client_ID());
else if ("C_Element_ID".equals(name))
para.setP_Number(C_Element_ID);
para.saveEx();
}
//
ProcessInfo pi = new ProcessInfo(process.getName(), process.getAD_Process_ID(), 0, 0);
pi.setAD_User_ID(getAD_User_ID());
pi.setAD_Client_ID(m_client.getAD_Client_ID());
pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID());
if (!process.processItWithoutTrxClose(pi, m_trx))
return false;
boolean success = m_trx.commit();
m_trx.close();
return success;
}
Aggregations