use of com.axelor.apps.production.db.SopLine in project axelor-open-suite by axelor.
the class SopServiceImpl method linkSOPLines.
@Transactional
protected void linkSOPLines(Sop sop, List<SopLine> sopLineList) {
sop = sopRepo.find(sop.getId());
sop.clearSopLineList();
for (SopLine sopLine : sopLineList) {
sop.addSopLineListItem(sopLine);
}
sop.setIsGenerated(true);
sopRepo.save(sop);
}
use of com.axelor.apps.production.db.SopLine in project axelor-open-suite by axelor.
the class SopServiceImpl method createSOPLine.
protected SopLine createSOPLine(Sop sop, Period period) {
SopLine sopLine = new SopLine();
sopLine.setPeriod(period);
sopLine.setYear(period.getYear());
sopLine.setCurrency(sop.getCompany().getCurrency());
sop.addSopLineListItem(sopLine);
return sopLine;
}
use of com.axelor.apps.production.db.SopLine in project axelor-open-suite by axelor.
the class SopServiceImpl method generateSOPLines.
@Override
public void generateSOPLines(Sop sop) throws AxelorException {
today = appBaseService.getTodayDate(sop.getCompany());
List<Period> yearPeriods = periodRepo.all().filter("self.year = :year AND self.statusSelect = :status").bind("year", sop.getYear()).bind("status", PeriodRepository.STATUS_OPENED).fetch();
List<SopLine> sopLineList = new ArrayList<SopLine>();
for (Period period : yearPeriods) {
sopLineList.add(this.createSOPLine(sop, period));
}
this.linkSOPLines(sop, sopLineList);
this.updateSOPLines(sop);
}
Aggregations