from apps.warehouse.models import InventoryEntry


def get_products_in_warehouse(organization_id):
    """ get list of products from organization warehouse """

    entries = InventoryEntry.objects.select_related(
        'distribution__quota__product'
    )

    product_objects = [
        entry.distribution.quota.product for entry in entries
    ]

    return list(set(product_objects))

