use of com.axelor.apps.base.db.Wizard in project axelor-open-suite by axelor.
the class SaleOrderController method generateSaleOrderWizard.
public void generateSaleOrderWizard(ActionRequest request, ActionResponse response) {
SaleOrder saleOrderTemplate = request.getContext().asType(SaleOrder.class);
Partner clientPartner = saleOrderTemplate.getClientPartner();
response.setView(ActionView.define("Create the quotation").model(Wizard.class.getName()).add("form", "sale-order-template-wizard-form").param("popup", "reload").param("show-toolbar", "false").param("show-confirm", "false").param("width", "large").param("popup-save", "false").context("_saleOrderTemplate", saleOrderTemplate).context("_clientPartnerCurrency", clientPartner.getCurrency()).map());
}
use of com.axelor.apps.base.db.Wizard in project axelor-open-suite by axelor.
the class StockMoveLineController method openTrackNumberWizard.
public void openTrackNumberWizard(ActionRequest request, ActionResponse response) {
Context context = request.getContext();
StockMoveLine stockMoveLine = context.asType(StockMoveLine.class);
StockMove stockMove = null;
if (context.getParent() != null && context.getParent().get("_model").equals("com.axelor.apps.stock.db.StockMove")) {
stockMove = context.getParent().asType(StockMove.class);
} else if (stockMoveLine.getStockMove() != null && stockMoveLine.getStockMove().getId() != null) {
stockMove = Beans.get(StockMoveRepository.class).find(stockMoveLine.getStockMove().getId());
}
boolean _hasWarranty = false, _isPerishable = false;
if (stockMoveLine.getProduct() != null) {
_hasWarranty = stockMoveLine.getProduct().getHasWarranty();
_isPerishable = stockMoveLine.getProduct().getIsPerishable();
}
response.setView(ActionView.define(I18n.get(IExceptionMessage.TRACK_NUMBER_WIZARD_TITLE)).model(Wizard.class.getName()).add("form", "stock-move-line-track-number-wizard-form").param("popup", "reload").param("show-toolbar", "false").param("show-confirm", "false").param("width", "large").param("popup-save", "false").context("_stockMove", stockMove).context("_stockMoveLine", stockMoveLine).context("_hasWarranty", _hasWarranty).context("_isPerishable", _isPerishable).map());
}
use of com.axelor.apps.base.db.Wizard in project axelor-open-suite by axelor.
the class WkfModelController method showDashboard.
public void showDashboard(ActionRequest request, ActionResponse response) {
try {
WkfModel wkfModel = request.getContext().asType(WkfModel.class);
wkfModel = wkfModelRepository.find(wkfModel.getId());
if (CollectionUtils.isEmpty(wkfModel.getWkfProcessList())) {
return;
}
if (wkfModel.getWkfProcessList().size() == 1) {
response.setView(ActionView.define(I18n.get("Workflow dashboard")).add("dashboard", "dasbhoard-wkf-model").context("_wkfId", wkfModel.getId()).context("_process", wkfModel.getWkfProcessList().get(0).getName()).map());
} else {
response.setView(ActionView.define(I18n.get("Select process")).model(Wizard.class.getName()).add("form", "wfk-model-select-process-wizard-form").param("popup", "true").param("popup-save", "false").param("show-confirm", "false").param("show-toolbar", "false").context("_wkf", wkfModel).map());
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.base.db.Wizard in project axelor-open-suite by axelor.
the class DuplicateObjectsController method defaultObjects.
public void defaultObjects(ActionRequest request, ActionResponse response) throws SecurityException {
List<Long> selectedIds = new ArrayList<>();
List<Object[]> duplicateObjects = new ArrayList<>();
List<Wizard> wizardDataList = new ArrayList<>();
DuplicateObjectsService duplicateObjectsService = Beans.get(DuplicateObjectsService.class);
for (Integer id : (List<Integer>) request.getContext().get("_ids")) {
selectedIds.add(Long.parseLong("" + id));
}
String modelName = request.getContext().get("_modelName").toString();
List<Object> duplicateObj = duplicateObjectsService.getAllSelectedObject(selectedIds, modelName);
for (Object object : duplicateObj) {
Long id = (Long) Mapper.of(object.getClass()).get(object, "id");
Property propertyNameColumn = Mapper.of(object.getClass()).getNameField();
String nameColumn = propertyNameColumn == null ? null : propertyNameColumn.getName().toString();
Property propertyCode = Mapper.of(object.getClass()).getProperty("code");
String code = propertyCode == null ? null : propertyCode.getName().toString();
String noColumn = null;
if (nameColumn != null) {
duplicateObjects.add((Object[]) duplicateObjectsService.getWizardValue(id, modelName, nameColumn));
} else if (code != null) {
duplicateObjects.add((Object[]) duplicateObjectsService.getWizardValue(id, modelName, code));
} else {
Object obj = duplicateObjectsService.getWizardValue(id, modelName, noColumn);
Wizard wizard = new Wizard();
wizard.setRecordId(obj.toString());
wizard.setName(obj.toString());
wizardDataList.add(wizard);
}
}
for (Object[] obj : duplicateObjects) {
String recordName = obj[1].toString();
String recordId = obj[0].toString();
Wizard wizard = new Wizard();
wizard.setRecordId(recordId);
wizard.setRecordName(recordName);
wizard.setName(recordName);
wizardDataList.add(wizard);
}
response.setAttr("$duplicateObjects", "value", wizardDataList);
}
use of com.axelor.apps.base.db.Wizard in project axelor-open-suite by axelor.
the class PaymentScheduleLineController method showRejectWizard.
@SuppressWarnings("unchecked")
public void showRejectWizard(ActionRequest request, ActionResponse response) {
try {
List<? extends Number> idList;
Number id = (Number) request.getContext().get("id");
if (id != null) {
idList = Lists.newArrayList(id);
} else {
idList = MoreObjects.firstNonNull((List<? extends Number>) request.getContext().get("_ids"), Collections.emptyList());
}
if (idList.isEmpty()) {
response.setError(I18n.get(com.axelor.apps.base.exceptions.IExceptionMessage.RECORD_NONE_SELECTED));
return;
}
ActionViewBuilder view = ActionView.define(I18n.get("Payment schedule lines to reject")).model(Wizard.class.getName()).add("form", "payment-schedule-line-reject-wizard-form").param("popup", "reload").param("show-toolbar", Boolean.FALSE.toString()).param("show-confirm", Boolean.FALSE.toString()).param("popup-save", Boolean.FALSE.toString()).context("idList", idList);
response.setView(view.map());
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations