Search in sources :

Example 1 with ContractService

use of com.axelor.apps.contract.service.ContractService in project axelor-open-suite by axelor.

the class ContractController method close.

public void close(ActionRequest request, ActionResponse response) {
    Contract contract = Beans.get(ContractRepository.class).find(request.getContext().asType(Contract.class).getId());
    ContractService service = Beans.get(ContractService.class);
    try {
        service.checkCanTerminateContract(contract);
        service.close(contract, contract.getTerminatedDate());
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ContractRepository(com.axelor.apps.contract.db.repo.ContractRepository) ContractService(com.axelor.apps.contract.service.ContractService) Contract(com.axelor.apps.contract.db.Contract)

Example 2 with ContractService

use of com.axelor.apps.contract.service.ContractService in project axelor-open-suite by axelor.

the class ContractController method terminated.

public void terminated(ActionRequest request, ActionResponse response) {
    Contract contract = Beans.get(ContractRepository.class).find(request.getContext().asType(Contract.class).getId());
    try {
        ContractService service = Beans.get(ContractService.class);
        service.checkCanTerminateContract(contract);
        service.terminateContract(contract, true, contract.getTerminatedDate());
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ContractRepository(com.axelor.apps.contract.db.repo.ContractRepository) ContractService(com.axelor.apps.contract.service.ContractService) Contract(com.axelor.apps.contract.db.Contract)

Aggregations

Contract (com.axelor.apps.contract.db.Contract)2 ContractRepository (com.axelor.apps.contract.db.repo.ContractRepository)2 ContractService (com.axelor.apps.contract.service.ContractService)2