Search in sources :

Example 1 with SupplierViewService

use of com.axelor.apps.supplierportal.service.SupplierViewService 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 2 with SupplierViewService

use of com.axelor.apps.supplierportal.service.SupplierViewService 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 3 with SupplierViewService

use of com.axelor.apps.supplierportal.service.SupplierViewService 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)

Example 4 with SupplierViewService

use of com.axelor.apps.supplierportal.service.SupplierViewService in project axelor-open-suite by axelor.

the class SupplierViewController method getDeliveriesToPrepare.

public void getDeliveriesToPrepare(ActionRequest request, ActionResponse response) {
    try {
        SupplierViewService supplierViewService = Beans.get(SupplierViewService.class);
        User user = supplierViewService.getSupplierUser();
        String domain = Beans.get(SupplierViewService.class).getDeliveriesToPrepareOfSupplier(user);
        response.setView(ActionView.define(I18n.get("Deliveries to prepare")).model(StockMove.class.getName()).add("grid", "stock-move-supplier-grid").add("form", "stock-move-supplier-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 5 with SupplierViewService

use of com.axelor.apps.supplierportal.service.SupplierViewService in project axelor-open-suite by axelor.

the class SupplierViewController method getLastDelivery.

/* StockMove OnClick*/
public void getLastDelivery(ActionRequest request, ActionResponse response) {
    try {
        SupplierViewService supplierViewService = Beans.get(SupplierViewService.class);
        User user = supplierViewService.getSupplierUser();
        String domain = Beans.get(SupplierViewService.class).getLastDeliveryOfSupplier(user);
        StockMove stockMove = Beans.get(StockMoveRepository.class).all().filter(domain).fetchOne();
        if (stockMove != null) {
            response.setView(ActionView.define(I18n.get("Last delivery")).model(StockMove.class.getName()).add("form", "stock-move-supplier-form").domain(domain).context("_showRecord", stockMove.getId()).map());
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : User(com.axelor.auth.db.User) StockMove(com.axelor.apps.stock.db.StockMove) SupplierViewService(com.axelor.apps.supplierportal.service.SupplierViewService) StockMoveRepository(com.axelor.apps.stock.db.repo.StockMoveRepository)

Aggregations

SupplierViewService (com.axelor.apps.supplierportal.service.SupplierViewService)9 User (com.axelor.auth.db.User)9 StockMove (com.axelor.apps.stock.db.StockMove)2 StockMoveRepository (com.axelor.apps.stock.db.repo.StockMoveRepository)2 PurchaseOrder (com.axelor.apps.purchase.db.PurchaseOrder)1 PurchaseOrderRepository (com.axelor.apps.purchase.db.repo.PurchaseOrderRepository)1