Search in sources :

Example 1 with DebtRecoveryConfigLine

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

the class DebtRecoverySessionService method getDebtRecoveryMethod.

/**
 * Fonction permettant de récupérer une méthode de relance en fonction de la categorie du tiers et
 * d'une société
 *
 * @param debtRecovery Une relance
 * @return
 */
public DebtRecoveryMethod getDebtRecoveryMethod(DebtRecovery debtRecovery) {
    AccountingSituation accountingSituation = debtRecovery.getTradingName() == null ? debtRecovery.getAccountingSituation() : debtRecovery.getTradingNameAccountingSituation();
    Company company = accountingSituation.getCompany();
    Partner partner = accountingSituation.getPartner();
    List<DebtRecoveryConfigLine> debtRecoveryConfigLines = company.getAccountConfig().getDebtRecoveryConfigLineList();
    for (DebtRecoveryConfigLine debtRecoveryConfigLine : debtRecoveryConfigLines) {
        if (debtRecoveryConfigLine.getPartnerCategory().equals(partner.getPartnerCategory())) {
            log.debug("méthode de relance determinée ");
            return debtRecoveryConfigLine.getDebtRecoveryMethod();
        }
    }
    log.debug("méthode de relance non determinée ");
    return null;
}
Also used : Company(com.axelor.apps.base.db.Company) AccountingSituation(com.axelor.apps.account.db.AccountingSituation) Partner(com.axelor.apps.base.db.Partner) DebtRecoveryConfigLine(com.axelor.apps.account.db.DebtRecoveryConfigLine)

Aggregations

AccountingSituation (com.axelor.apps.account.db.AccountingSituation)1 DebtRecoveryConfigLine (com.axelor.apps.account.db.DebtRecoveryConfigLine)1 Company (com.axelor.apps.base.db.Company)1 Partner (com.axelor.apps.base.db.Partner)1