use of com.axelor.apps.purchase.db.SupplierCatalog in project axelor-open-suite by axelor.
the class PurchaseOrderSupplierService method generateSuppliersRequests.
@Transactional
public void generateSuppliersRequests(PurchaseOrderLine purchaseOrderLine, PurchaseOrder purchaseOrder) {
if (purchaseOrder == null) {
return;
}
Product product = purchaseOrderLine.getProduct();
Company company = purchaseOrder.getCompany();
if (Beans.get(AppPurchaseService.class).getAppPurchase().getManageSupplierCatalog() && product != null && product.getSupplierCatalogList() != null) {
for (SupplierCatalog supplierCatalog : product.getSupplierCatalogList()) {
Partner supplierPartner = supplierCatalog.getSupplierPartner();
Blocking blocking = Beans.get(BlockingService.class).getBlocking(supplierPartner, company, BlockingRepository.PURCHASE_BLOCKING);
if (blocking == null) {
purchaseOrderLine.addPurchaseOrderSupplierLineListItem(purchaseOrderSupplierLineService.create(supplierPartner, supplierCatalog.getPrice()));
}
}
}
Beans.get(PurchaseOrderLineRepository.class).save(purchaseOrderLine);
}
Aggregations