Search in sources :

Example 61 with User

use of com.axelor.auth.db.User in project axelor-open-suite by axelor.

the class ClientViewController method showClientMyTasksInProgress.

public void showClientMyTasksInProgress(ActionRequest request, ActionResponse response) {
    try {
        ClientViewService clientViewService = Beans.get(ClientViewService.class);
        User clientUser = clientViewService.getClientUser();
        if (clientUser.getPartner() == null) {
            response.setError(I18n.get(ITranslation.CLIENT_PORTAL_NO_PARTNER));
        } else {
            Filter filter = clientViewService.getTasksInProgressOfUser(clientUser).get(0);
            if (filter != null) {
                response.setView(ActionView.define(I18n.get("Tasks in progress")).model(ProjectTask.class.getName()).add("grid", "project-task-grid").add("form", "project-task-form").param("search-filters", "project-task-filters").domain(filter.getQuery()).map());
            }
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ClientViewService(com.axelor.apps.portal.service.ClientViewService) User(com.axelor.auth.db.User) Filter(com.axelor.rpc.filter.Filter) ProjectTask(com.axelor.apps.project.db.ProjectTask)

Example 62 with User

use of com.axelor.auth.db.User in project axelor-open-suite by axelor.

the class ClientViewController method showClientMyTotalRemaining.

public void showClientMyTotalRemaining(ActionRequest request, ActionResponse response) {
    try {
        ClientViewService clientViewService = Beans.get(ClientViewService.class);
        User clientUser = clientViewService.getClientUser();
        if (clientUser.getPartner() == null) {
            response.setError(I18n.get(ITranslation.CLIENT_PORTAL_NO_PARTNER));
        } else {
            Filter filter = clientViewService.getTotalRemainingOfUser(clientUser).get(0);
            if (filter != null) {
                response.setView(ActionView.define(I18n.get("Total remaining")).model(Invoice.class.getName()).add("grid", "invoice-grid").add("form", "invoice-form").param("search-filters", "customer-invoices-filters").domain(filter.getQuery()).map());
            }
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ClientViewService(com.axelor.apps.portal.service.ClientViewService) User(com.axelor.auth.db.User) Invoice(com.axelor.apps.account.db.Invoice) Filter(com.axelor.rpc.filter.Filter)

Example 63 with User

use of com.axelor.auth.db.User in project axelor-open-suite by axelor.

the class SupplierViewController method getLastOrder.

public void getLastOrder(ActionRequest request, ActionResponse response) {
    try {
        SupplierViewService supplierViewService = Beans.get(SupplierViewService.class);
        User user = supplierViewService.getSupplierUser();
        String domain = Beans.get(SupplierViewService.class).getLastPurchaseOrderOfSupplier(user);
        PurchaseOrder purchaseOrder = Beans.get(PurchaseOrderRepository.class).all().filter(domain).fetchOne();
        if (purchaseOrder != null) {
            response.setView(ActionView.define(I18n.get("Last order")).model(PurchaseOrder.class.getName()).add("form", "purchase-order-form").context("_showRecord", purchaseOrder.getId()).map());
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : User(com.axelor.auth.db.User) SupplierViewService(com.axelor.apps.supplierportal.service.SupplierViewService) PurchaseOrder(com.axelor.apps.purchase.db.PurchaseOrder) PurchaseOrderRepository(com.axelor.apps.purchase.db.repo.PurchaseOrderRepository)

Example 64 with User

use of com.axelor.auth.db.User in project axelor-open-suite by axelor.

the class SupplierViewController method getOverdueInvoice.

/* Invoice */
/* TODO REVOIR LE COMPTEUR LE BOUTON*/
public void getOverdueInvoice(ActionRequest request, ActionResponse response) {
    try {
        SupplierViewService supplierViewService = Beans.get(SupplierViewService.class);
        User user = supplierViewService.getSupplierUser();
        String domain = Beans.get(SupplierViewService.class).getOverdueInvoicesOfSupplier(user);
        response.setView(ActionView.define(I18n.get("Overdue invoices")).model(Invoice.class.getName()).add("grid", "invoice-grid").add("form", "invoice-form").domain(domain).map());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : User(com.axelor.auth.db.User) SupplierViewService(com.axelor.apps.supplierportal.service.SupplierViewService)

Example 65 with User

use of com.axelor.auth.db.User in project axelor-open-suite by axelor.

the class SupplierViewController method getAwaitingInvoice.

public void getAwaitingInvoice(ActionRequest request, ActionResponse response) {
    try {
        SupplierViewService supplierViewService = Beans.get(SupplierViewService.class);
        User user = supplierViewService.getSupplierUser();
        String domain = Beans.get(SupplierViewService.class).getAwaitingInvoicesOfSupplier(user);
        response.setView(ActionView.define(I18n.get("Awaiting invoice")).model(Invoice.class.getName()).add("grid", "invoice-grid").add("form", "invoice-form").domain(domain).map());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : User(com.axelor.auth.db.User) SupplierViewService(com.axelor.apps.supplierportal.service.SupplierViewService)

Aggregations

User (com.axelor.auth.db.User)157 AxelorException (com.axelor.exception.AxelorException)35 Employee (com.axelor.apps.hr.db.Employee)28 ArrayList (java.util.ArrayList)25 HashMap (java.util.HashMap)25 Transactional (com.google.inject.persist.Transactional)24 LocalDate (java.time.LocalDate)23 Filter (com.axelor.rpc.filter.Filter)22 BigDecimal (java.math.BigDecimal)22 ClientViewService (com.axelor.apps.portal.service.ClientViewService)20 ActionViewBuilder (com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)17 List (java.util.List)17 Map (java.util.Map)16 TimesheetLine (com.axelor.apps.hr.db.TimesheetLine)12 LocalDateTime (java.time.LocalDateTime)12 Company (com.axelor.apps.base.db.Company)11 Partner (com.axelor.apps.base.db.Partner)11 Beans (com.axelor.inject.Beans)11 Inject (com.google.inject.Inject)11 Product (com.axelor.apps.base.db.Product)9