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);
}
}
Aggregations