use of com.axelor.apps.supplychain.db.SupplyChainConfig in project axelor-open-suite by axelor.
the class ManufOrderStockMoveService method createToConsumeStockMove.
public void createToConsumeStockMove(ManufOrder manufOrder) throws AxelorException {
Company company = manufOrder.getCompany();
SupplyChainConfig supplyChainConfig = supplyChainConfigService.getSupplyChainConfig(company);
if (manufOrder.getToConsumeProdProductList() != null && company != null) {
StockMove stockMove = this._createToConsumeStockMove(manufOrder, company);
for (ProdProduct prodProduct : manufOrder.getToConsumeProdProductList()) {
this._createStockMoveLine(prodProduct, stockMove, StockMoveLineService.TYPE_IN_PRODUCTIONS);
}
if (stockMove.getStockMoveLineList() != null && !stockMove.getStockMoveLineList().isEmpty()) {
stockMoveService.plan(stockMove);
if (supplyChainConfig.getAutoRequestReservedQtyOnManufOrder()) {
requestStockReservation(stockMove);
}
manufOrder.addInStockMoveListItem(stockMove);
}
// case where we had to split tracked stock move lines
if (stockMove.getStockMoveLineList() != null) {
for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
manufOrder.addConsumedStockMoveLineListItem(stockMoveLine);
}
}
}
}
Aggregations