Search in sources :

Example 1 with Wizard

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());
}
Also used : SaleOrder(com.axelor.apps.sale.db.SaleOrder) Partner(com.axelor.apps.base.db.Partner) Wizard(com.axelor.apps.base.db.Wizard)

Example 2 with Wizard

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());
}
Also used : Context(com.axelor.rpc.Context) StockMove(com.axelor.apps.stock.db.StockMove) StockMoveLine(com.axelor.apps.stock.db.StockMoveLine) StockMoveRepository(com.axelor.apps.stock.db.repo.StockMoveRepository) Wizard(com.axelor.apps.base.db.Wizard)

Example 3 with Wizard

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);
    }
}
Also used : WkfModel(com.axelor.apps.bpm.db.WkfModel) Wizard(com.axelor.apps.base.db.Wizard) AxelorException(com.axelor.exception.AxelorException)

Example 4 with Wizard

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);
}
Also used : ArrayList(java.util.ArrayList) DuplicateObjectsService(com.axelor.apps.base.service.DuplicateObjectsService) ArrayList(java.util.ArrayList) List(java.util.List) Wizard(com.axelor.apps.base.db.Wizard) Property(com.axelor.db.mapper.Property)

Example 5 with Wizard

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);
    }
}
Also used : List(java.util.List) Wizard(com.axelor.apps.base.db.Wizard) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)

Aggregations

Wizard (com.axelor.apps.base.db.Wizard)9 AxelorException (com.axelor.exception.AxelorException)4 List (java.util.List)3 Model (com.axelor.db.Model)2 ActionViewBuilder (com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)2 AppProject (com.axelor.apps.base.db.AppProject)1 Partner (com.axelor.apps.base.db.Partner)1 Print (com.axelor.apps.base.db.Print)1 PrintTemplate (com.axelor.apps.base.db.PrintTemplate)1 DuplicateObjectsService (com.axelor.apps.base.service.DuplicateObjectsService)1 WkfModel (com.axelor.apps.bpm.db.WkfModel)1 Project (com.axelor.apps.project.db.Project)1 ProjectTemplate (com.axelor.apps.project.db.ProjectTemplate)1 AppProjectService (com.axelor.apps.project.service.app.AppProjectService)1 SaleOrder (com.axelor.apps.sale.db.SaleOrder)1 StockMove (com.axelor.apps.stock.db.StockMove)1 StockMoveLine (com.axelor.apps.stock.db.StockMoveLine)1 StockMoveRepository (com.axelor.apps.stock.db.repo.StockMoveRepository)1 Property (com.axelor.db.mapper.Property)1 Context (com.axelor.rpc.Context)1