private void createSavePaymentTerm() {
setAccess();
final List<PaymentTerm> result = new ArrayList<PaymentTerm>();
for (int i = 0; i < NO_OF_PT; i++) {
final PaymentTerm source = OBDal.getInstance().get(PaymentTerm.class, "1000000");
final PaymentTerm pt = (PaymentTerm) DalUtil.copy(source, false);
pt.setName("test " + i);
pt.setOrganization(OBContext.getOBContext().getCurrentOrganization());
// force new
// now add a payment termline
for (int j = 0; j < NO_OF_PT_LINE; j++) {
final PaymentTermLine ptl = OBProvider.getInstance().get(PaymentTermLine.class);
ptl.setExcludeTax(true);
ptl.setLastDayCutoff(new Long(10));
ptl.setMaturityDate1(new Long(5));
ptl.setMaturityDate2(new Long(1));
ptl.setMaturityDate3(new Long(1));
ptl.setOffsetMonthDue(new Long(j));
ptl.setLineNo((long) j);
ptl.setOverduePaymentDayRule("1");
ptl.setOverduePaymentDaysRule((long) 10);
ptl.setNextBusinessDay(true);
ptl.setRest(true);
ptl.setPaymentTerms(pt);
ptl.setPercentageDue(1.0f);
pt.getFinancialMgmtPaymentTermLineList().add(ptl);
}
result.add(pt);
}
for (final PaymentTerm pt : result) {
OBDal.getInstance().save(pt);