use of com.axelor.apps.base.db.PrintingSettings in project axelor-open-suite by axelor.
the class SaleOrderController method filterPrintingSettings.
/**
* Called on printing settings select. Set the domain for {@link SaleOrder#printingSettings}
*
* @param request
* @param response
*/
public void filterPrintingSettings(ActionRequest request, ActionResponse response) {
try {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
List<PrintingSettings> printingSettingsList = Beans.get(TradingNameService.class).getPrintingSettingsList(saleOrder.getTradingName(), saleOrder.getCompany());
String domain = String.format("self.id IN (%s)", !printingSettingsList.isEmpty() ? StringTool.getIdListString(printingSettingsList) : "0");
response.setAttr("printingSettings", "domain", domain);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.base.db.PrintingSettings in project axelor-open-suite by axelor.
the class InvoiceController method filterPrintingSettings.
/**
* Called on printing settings select. Set the domain for {@link Invoice#printingSettings}
*
* @param request
* @param response
*/
public void filterPrintingSettings(ActionRequest request, ActionResponse response) {
Invoice invoice = request.getContext().asType(Invoice.class);
List<PrintingSettings> printingSettingsList = Beans.get(TradingNameService.class).getPrintingSettingsList(invoice.getTradingName(), invoice.getCompany());
String domain = String.format("self.id IN (%s)", !printingSettingsList.isEmpty() ? StringTool.getIdListString(printingSettingsList) : "0");
response.setAttr("printingSettings", "domain", domain);
}
use of com.axelor.apps.base.db.PrintingSettings in project axelor-open-suite by axelor.
the class MessageServiceBaseImpl method printMessage.
@SuppressWarnings("unchecked")
@Override
public String printMessage(Message message) throws AxelorException {
Company company = message.getCompany();
if (company == null) {
return null;
}
PrintingSettings printSettings = company.getPrintingSettings();
if (printSettings == null || printSettings.getDefaultMailBirtTemplate() == null) {
return null;
}
BirtTemplate birtTemplate = printSettings.getDefaultMailBirtTemplate();
logger.debug("Default BirtTemplate : {}", birtTemplate);
Templates templates = new StringTemplates('$', '$');
Map<String, Object> templatesContext = Maps.newHashMap();
try {
Class<? extends Model> className = (Class<? extends Model>) Class.forName(message.getClass().getName());
templatesContext.put("Message", JPA.find(className, message.getId()));
} catch (ClassNotFoundException e) {
TraceBackService.trace(e);
}
String fileName = "Message " + message.getSubject() + "-" + appBaseService.getTodayDate(company).format(DateTimeFormatter.BASIC_ISO_DATE);
return Beans.get(TemplateMessageServiceBaseImpl.class).generateBirtTemplateLink(templates, templatesContext, fileName, birtTemplate.getTemplateLink(), birtTemplate.getFormat(), birtTemplate.getBirtTemplateParameterList());
}
use of com.axelor.apps.base.db.PrintingSettings in project axelor-open-suite by axelor.
the class PurchaseOrderController method filterPrintingSettings.
/**
* Called on printing settings select. Set the domain for {@link PurchaseOrder#printingSettings}
*
* @param request
* @param response
*/
public void filterPrintingSettings(ActionRequest request, ActionResponse response) {
try {
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
List<PrintingSettings> printingSettingsList = Beans.get(TradingNameService.class).getPrintingSettingsList(purchaseOrder.getTradingName(), purchaseOrder.getCompany());
String domain = String.format("self.id IN (%s)", !printingSettingsList.isEmpty() ? StringTool.getIdListString(printingSettingsList) : "0");
response.setAttr("printingSettings", "domain", domain);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.base.db.PrintingSettings in project axelor-open-suite by axelor.
the class StockMoveController method filterPrintingSettings.
/**
* Called on printing settings select. Set the the domain for {@link StockMove#printingSettings}
*
* @param request
* @param response
*/
public void filterPrintingSettings(ActionRequest request, ActionResponse response) {
try {
StockMove stockMove = request.getContext().asType(StockMove.class);
List<PrintingSettings> printingSettingsList = Beans.get(TradingNameService.class).getPrintingSettingsList(stockMove.getTradingName(), stockMove.getCompany());
String domain = String.format("self.id IN (%s)", !printingSettingsList.isEmpty() ? StringTool.getIdListString(printingSettingsList) : "0");
response.setAttr("printingSettings", "domain", domain);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations