Search in sources :

Example 1 with ProductCategoryId

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();
}
Also used : Money(de.metas.money.Money) ProductCategoryId(de.metas.product.ProductCategoryId) IProductDAO(de.metas.product.IProductDAO) ProductId(de.metas.product.ProductId)

Aggregations

Money (de.metas.money.Money)1 IProductDAO (de.metas.product.IProductDAO)1 ProductCategoryId (de.metas.product.ProductCategoryId)1 ProductId (de.metas.product.ProductId)1