use of com.axelor.apps.supplychain.service.StockMoveReservedQtyService in project axelor-open-suite by axelor.
the class StockMoveController method allocateAll.
/**
* Called from stock move form view, on available qty boolean change. Only called if the user
* accepted to allocate everything. Call {@link
* StockMoveReservedQtyService#allocateAll(StockMove)}.
*
* @param request
* @param response
*/
public void allocateAll(ActionRequest request, ActionResponse response) {
try {
StockMove stockMove = request.getContext().asType(StockMove.class);
Company company = stockMove.getCompany();
if (company == null) {
return;
}
SupplyChainConfig supplyChainConfig = Beans.get(SupplyChainConfigService.class).getSupplyChainConfig(company);
if (!Beans.get(AppSupplychainService.class).getAppSupplychain().getManageStockReservation() || !stockMove.getAvailabilityRequest() || !supplyChainConfig.getAutoAllocateOnAvailabilityRequest()) {
return;
}
Beans.get(StockMoveReservedQtyService.class).allocateAll(stockMove);
} catch (Exception e) {
TraceBackService.trace(response, e);
} finally {
response.setReload(true);
}
}
Aggregations