use of com.axelor.apps.hr.db.Employee in project axelor-open-suite by axelor.
the class EmployeeController method printEmployeeReport.
public void printEmployeeReport(ActionRequest request, ActionResponse response) throws AxelorException {
Employee employee = request.getContext().asType(Employee.class);
String name = I18n.get("Employee");
String fileLink = ReportFactory.createReport(IReport.EMPLOYEE, name + "-${date}").addParam("EmployeeId", employee.getId()).addParam("Timezone", getTimezone(employee.getUser())).addParam("Locale", ReportSettings.getPrintingLocale(null)).generate().getFileLink();
LOG.debug("Printing " + name);
response.setView(ActionView.define(name).add("html", fileLink).map());
}
use of com.axelor.apps.hr.db.Employee 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);
}
use of com.axelor.apps.hr.db.Employee 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());
}
use of com.axelor.apps.hr.db.Employee 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());
}
use of com.axelor.apps.hr.db.Employee in project axelor-open-suite by axelor.
the class LeaveController method historicLeave.
public void historicLeave(ActionRequest request, ActionResponse response) {
try {
User user = AuthUtils.getUser();
Employee employee = user.getEmployee();
ActionViewBuilder actionView = ActionView.define(I18n.get("Colleague Leave Requests")).model(LeaveRequest.class.getName()).add("grid", "leave-request-grid").add("form", "leave-request-form").param("search-filters", "leave-request-filters");
actionView.domain("(self.statusSelect = 3 OR self.statusSelect = 4)");
if (employee == null || !employee.getHrManager()) {
actionView.domain(actionView.get().getDomain() + " AND self.user.employee.managerUser = :_user").context("_user", user);
}
response.setView(actionView.map());
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations