Search in sources :

Example 6 with ReconcileGroup

use of com.axelor.apps.account.db.ReconcileGroup in project axelor-open-suite by axelor.

the class ReconcileGroupServiceImpl method mergeReconcileGroups.

@Override
@Transactional
public ReconcileGroup mergeReconcileGroups(List<ReconcileGroup> reconcileGroupList) {
    Company company = reconcileGroupList.get(0).getCompany();
    ReconcileGroup reconcileGroup = createReconcileGroup(company);
    List<Reconcile> reconcileList = reconcileRepository.all().filter("self.reconcileGroup.id IN (:reconcileGroupIds)").bind("reconcileGroupIds", reconcileGroupList.stream().map(ReconcileGroup::getId).collect(Collectors.toList())).fetch();
    reconcileList.forEach(reconcile -> addToReconcileGroup(reconcileGroup, reconcile));
    for (ReconcileGroup toDeleteReconcileGroup : reconcileGroupList) {
        reconcileGroupRepository.remove(toDeleteReconcileGroup);
    }
    return reconcileGroupRepository.save(reconcileGroup);
}
Also used : Company(com.axelor.apps.base.db.Company) ReconcileGroup(com.axelor.apps.account.db.ReconcileGroup) Reconcile(com.axelor.apps.account.db.Reconcile) Transactional(com.google.inject.persist.Transactional)

Example 7 with ReconcileGroup

use of com.axelor.apps.account.db.ReconcileGroup in project axelor-open-suite by axelor.

the class ReconcileServiceImpl method addToReconcileGroup.

@Override
public void addToReconcileGroup(Reconcile reconcile) throws AxelorException {
    ReconcileGroupService reconcileGroupService = Beans.get(ReconcileGroupService.class);
    ReconcileGroup reconcileGroup = reconcileGroupService.findOrCreateGroup(reconcile);
    reconcileGroupService.addAndValidate(reconcileGroup, reconcile);
}
Also used : ReconcileGroup(com.axelor.apps.account.db.ReconcileGroup)

Aggregations

ReconcileGroup (com.axelor.apps.account.db.ReconcileGroup)7 MoveLine (com.axelor.apps.account.db.MoveLine)3 Transactional (com.google.inject.persist.Transactional)3 Reconcile (com.axelor.apps.account.db.Reconcile)2 Company (com.axelor.apps.base.db.Company)2 AnalyticMoveLine (com.axelor.apps.account.db.AnalyticMoveLine)1 Journal (com.axelor.apps.account.db.Journal)1 Move (com.axelor.apps.account.db.Move)1 ReconcileGroupRepository (com.axelor.apps.account.db.repo.ReconcileGroupRepository)1 ReconcileGroupService (com.axelor.apps.account.service.ReconcileGroupService)1 Partner (com.axelor.apps.base.db.Partner)1 AxelorException (com.axelor.exception.AxelorException)1 LocalDate (java.time.LocalDate)1 ArrayList (java.util.ArrayList)1