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);
}
}
Aggregations