Search in sources :

Example 6 with ActionViewBuilder

use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.

the class TimesheetController method showSubordinateTimesheets.

public void showSubordinateTimesheets(ActionRequest request, ActionResponse response) {
    User user = AuthUtils.getUser();
    Company activeCompany = user.getActiveCompany();
    ActionViewBuilder actionView = ActionView.define(I18n.get("Timesheets to be Validated by your subordinates")).model(Timesheet.class.getName()).add("grid", "timesheet-grid").add("form", "timesheet-form").param("search-filters", "timesheet-filters");
    String domain = "self.user.employee.managerUser.employee.managerUser = :_user AND self.company = :_activeCompany AND self.statusSelect = 2";
    long nbTimesheets = Query.of(Timesheet.class).filter(domain).bind("_user", user).bind("_activeCompany", activeCompany).count();
    if (nbTimesheets == 0) {
        response.setNotify(I18n.get("No timesheet to be validated by your subordinates"));
    } else {
        response.setView(actionView.domain(domain).context("_user", user).context("_activeCompany", activeCompany).map());
    }
}
Also used : Company(com.axelor.apps.base.db.Company) User(com.axelor.auth.db.User) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)

Example 7 with ActionViewBuilder

use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.

the class EmployeeController method generateNewDPAE.

public void generateNewDPAE(ActionRequest request, ActionResponse response) {
    Employee employee = request.getContext().asType(Employee.class);
    employee = Beans.get(EmployeeRepository.class).find(employee.getId());
    try {
        Long dpaeId = Beans.get(EmployeeService.class).generateNewDPAE(employee);
        ActionViewBuilder builder = ActionView.define(I18n.get("DPAE")).model(DPAE.class.getName()).add("grid", "dpae-grid").add("form", "dpae-form").param("search-filters", "dpae-filters").context("_showRecord", dpaeId);
        response.setView(builder.map());
    } catch (AxelorException e) {
        TraceBackService.trace(response, e);
    }
    response.setReload(true);
}
Also used : DPAE(com.axelor.apps.hr.db.DPAE) AxelorException(com.axelor.exception.AxelorException) Employee(com.axelor.apps.hr.db.Employee) EmployeeService(com.axelor.apps.hr.service.employee.EmployeeService) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)

Example 8 with ActionViewBuilder

use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.

the class TimesheetController method historicTimesheetLine.

public void historicTimesheetLine(ActionRequest request, ActionResponse response) {
    User user = AuthUtils.getUser();
    Employee employee = user.getEmployee();
    ActionViewBuilder actionView = ActionView.define(I18n.get("See timesheet lines")).model(TimesheetLine.class.getName()).add("grid", "timesheet-line-grid").add("form", "timesheet-line-form");
    actionView.domain("self.timesheet.company = :_activeCompany AND (self.timesheet.statusSelect = 3 OR self.timesheet.statusSelect = 4)").context("_activeCompany", user.getActiveCompany());
    if (employee == null || !employee.getHrManager()) {
        actionView.domain(actionView.get().getDomain() + " AND self.timesheet.user.employee.managerUser = :_user").context("_user", user);
    }
    response.setView(actionView.map());
}
Also used : User(com.axelor.auth.db.User) Employee(com.axelor.apps.hr.db.Employee) TimesheetLine(com.axelor.apps.hr.db.TimesheetLine) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)

Example 9 with ActionViewBuilder

use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.

the class TSTimerController method editTimesheetTimerFromTimesheet.

public void editTimesheetTimerFromTimesheet(ActionRequest request, ActionResponse response) {
    ActionViewBuilder actionView = ActionView.define(I18n.get("TSTimer")).model(TSTimer.class.getName()).add("form", "ts-timer-form").param("popup", "reload").param("forceEdit", "true").param("width", "800").param("show-confirm", "true").param("show-toolbar", "false").param("popup-save", "true");
    TSTimer tsTimer = Beans.get(TimesheetTimerService.class).getCurrentTSTimer();
    if (tsTimer != null) {
        actionView.context("_showRecord", String.valueOf(tsTimer.getId()));
    }
    response.setView(actionView.map());
}
Also used : TSTimer(com.axelor.apps.hr.db.TSTimer) TimesheetTimerService(com.axelor.apps.hr.service.timesheet.timer.TimesheetTimerService) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)

Example 10 with ActionViewBuilder

use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.

the class ExtraHoursController method validateExtraHours.

public void validateExtraHours(ActionRequest request, ActionResponse response) throws AxelorException {
    User user = AuthUtils.getUser();
    Employee employee = user.getEmployee();
    ActionViewBuilder actionView = ActionView.define(I18n.get("Extra hours to Validate")).model(ExtraHours.class.getName()).add("grid", "extra-hours-validate-grid").add("form", "extra-hours-form").param("search-filters", "extra-hours-filters");
    Beans.get(HRMenuValidateService.class).createValidateDomain(user, employee, actionView);
    response.setView(actionView.map());
}
Also used : User(com.axelor.auth.db.User) Employee(com.axelor.apps.hr.db.Employee) HRMenuValidateService(com.axelor.apps.hr.service.HRMenuValidateService) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)

Aggregations

ActionViewBuilder (com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)54 AxelorException (com.axelor.exception.AxelorException)18 User (com.axelor.auth.db.User)17 List (java.util.List)15 Employee (com.axelor.apps.hr.db.Employee)14 Map (java.util.Map)14 ArrayList (java.util.ArrayList)13 Company (com.axelor.apps.base.db.Company)10 Partner (com.axelor.apps.base.db.Partner)9 Wizard (com.axelor.apps.base.db.Wizard)9 Invoice (com.axelor.apps.account.db.Invoice)8 Currency (com.axelor.apps.base.db.Currency)7 PriceList (com.axelor.apps.base.db.PriceList)7 LinkedHashMap (java.util.LinkedHashMap)6 SaleOrder (com.axelor.apps.sale.db.SaleOrder)5 StockMove (com.axelor.apps.stock.db.StockMove)5 MetaJsonRecord (com.axelor.meta.db.MetaJsonRecord)5 HRMenuValidateService (com.axelor.apps.hr.service.HRMenuValidateService)4 StockMoveMultiInvoiceService (com.axelor.apps.supplychain.service.StockMoveMultiInvoiceService)4 MetaJsonModel (com.axelor.meta.db.MetaJsonModel)4