use of de.metas.product.ProductCategoryId in project metasfresh-webui-api by metasfresh.
the class OrderLinePricingConditionsViewFactory method createSourceDocumentLine.
private final SourceDocumentLine createSourceDocumentLine(@NonNull final I_C_OrderLine orderLineRecord, @NonNull final SOTrx soTrx) {
final IProductDAO productsRepo = Services.get(IProductDAO.class);
final ProductId productId = ProductId.ofRepoId(orderLineRecord.getM_Product_ID());
final ProductCategoryId productCategoryId = productsRepo.retrieveProductCategoryByProductId(productId);
final Money priceEntered = Money.of(orderLineRecord.getPriceEntered(), CurrencyId.ofRepoId(orderLineRecord.getC_Currency_ID()));
return SourceDocumentLine.builder().orderLineId(OrderLineId.ofRepoIdOrNull(orderLineRecord.getC_OrderLine_ID())).soTrx(soTrx).bpartnerId(BPartnerId.ofRepoId(orderLineRecord.getC_BPartner_ID())).productId(productId).productCategoryId(productCategoryId).priceEntered(priceEntered).discount(Percent.of(orderLineRecord.getDiscount())).paymentTermId(PaymentTermId.ofRepoIdOrNull(orderLineRecord.getC_PaymentTerm_Override_ID())).pricingConditionsBreakId(PricingConditionsBreakId.ofOrNull(orderLineRecord.getM_DiscountSchema_ID(), orderLineRecord.getM_DiscountSchemaBreak_ID())).build();
}
Aggregations