Search in sources :

Example 1 with PurchaseOrderSupplychainService

use of com.axelor.apps.supplychain.service.PurchaseOrderSupplychainService in project axelor-open-suite by axelor.

the class PurchaseOrderController method applyToAllBudgetDistribution.

public void applyToAllBudgetDistribution(ActionRequest request, ActionResponse response) {
    try {
        PurchaseOrderSupplychainService purchaseOrderSupplychainService = Beans.get(PurchaseOrderSupplychainService.class);
        PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
        purchaseOrder = Beans.get(PurchaseOrderRepository.class).find(purchaseOrder.getId());
        AppBudget appBudget = Beans.get(AppBudgetRepository.class).all().fetchOne();
        if (appBudget.getManageMultiBudget()) {
            purchaseOrderSupplychainService.applyToallBudgetDistribution(purchaseOrder);
        } else {
            purchaseOrderSupplychainService.setPurchaseOrderLineBudget(purchaseOrder);
            response.setValue("purchaseOrderLineList", purchaseOrder.getPurchaseOrderLineList());
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : PurchaseOrder(com.axelor.apps.purchase.db.PurchaseOrder) PurchaseOrderSupplychainService(com.axelor.apps.supplychain.service.PurchaseOrderSupplychainService) AppBudget(com.axelor.apps.base.db.AppBudget) AxelorException(com.axelor.exception.AxelorException)

Aggregations

AppBudget (com.axelor.apps.base.db.AppBudget)1 PurchaseOrder (com.axelor.apps.purchase.db.PurchaseOrder)1 PurchaseOrderSupplychainService (com.axelor.apps.supplychain.service.PurchaseOrderSupplychainService)1 AxelorException (com.axelor.exception.AxelorException)1