Search in sources :

Example 1 with ContractTemplate

use of com.axelor.apps.contract.db.ContractTemplate in project axelor-open-suite by axelor.

the class ContractController method copyFromTemplate.

public void copyFromTemplate(ActionRequest request, ActionResponse response) {
    try {
        ContractTemplate template = ModelTool.toBean(ContractTemplate.class, request.getContext().get("contractTemplate"));
        template = Beans.get(ContractTemplateRepository.class).find(template.getId());
        Contract contract = Beans.get(ContractRepository.class).find(request.getContext().asType(Contract.class).getId());
        Beans.get(ContractService.class).copyFromTemplate(contract, template);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e, ResponseMessageType.ERROR);
    }
}
Also used : ContractTemplate(com.axelor.apps.contract.db.ContractTemplate) 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)1 ContractTemplate (com.axelor.apps.contract.db.ContractTemplate)1 ContractRepository (com.axelor.apps.contract.db.repo.ContractRepository)1 ContractService (com.axelor.apps.contract.service.ContractService)1