BloomERP

Built-ins

InboxFolderTypeDefinition

Describe how a folder type obtains, groups, and displays inbox items.

Define its item type and optional filters, actions, or sources. The persisted folder ID identifies the folder type and is also used when registering a source for it.

SettingTypeDefaultDescription
idstrRequiredStable ID identifying this folder type.
documentationstr''Markdown and tagged examples included in the generated developer reference.
namestrRequiredFolder type name shown to users.
descriptionOptional[str]NoneSummary of the folder type's purpose.
item_typeOptional[InboxItemTypeDefinition]NoneDefinition used to render and act on items in the folder.
iconOptional[str]NoneIcon shown for the folder type.
filtersUnion[list[InboxFolderTypeFilterDefinition], Callable[[Any], list[InboxFolderTypeFilterDefinition]], NoneType]NoneDeclared or computed inbox filter presets.
source_modelOptional[str]NoneDjango model label for the original records, when applicable.
actionsOptional[list[InboxActionDefinition]]NoneActions available at the folder level.
on_queryCallable[[dict[str, str], Any, bool], QuerySet]default_queryCallback used to query the folder's items.
is_aggregateboolFalseWhether this folder combines items from other folders.
aggregate_funcOptional[Callable[[Any], QuerySet]]NoneCallback that builds the aggregate item queryset.
is_defaultboolFalseWhether Bloomerp offers this type for default folder creation.
default_sourcesOptional[Annotated[list[InboxSignalSource | InboxJobSource | InboxEventSource], SkipValidation()]]NoneJobs, events, or signals that contribute to folders of this type.
on_groupOptional[Callable[[list[Any], QuerySet], list[InboxItemGroup]]]NoneOptional callback that groups related items in a folder's list.

Register a folder for review requests

Declare the folder and the item type its source will create.

python
from bloomerp.communication.definition import InboxFolderTypeDefinition, InboxItemTypeDefinition
from bloomerp.communication.registry import INBOX_FOLDER_REGISTRY

reviews = InboxFolderTypeDefinition(
    id="example_reviews",
    name="Reviews",
    description="Review requests generated by the project.",
    icon="fa-solid fa-clipboard-check",
    item_type=InboxItemTypeDefinition(key="example_review", name="Review request"),
)
INBOX_FOLDER_REGISTRY.register("EXAMPLE_REVIEWS", reviews)

Add an unread preset for a folder

Use a filter on the inbox item’s read state. The preset appears among the folder’s filters.

python
from bloomerp.communication.definition import InboxFolderTypeDefinition, InboxFolderTypeFilterDefinition
from bloomerp.communication.registry import INBOX_FOLDER_REGISTRY
from bloomerp.filters.definition import Filter, FilterCondition

announcements = InboxFolderTypeDefinition(
    id="example_announcements",
    name="Announcements",
    filters=[
        InboxFolderTypeFilterDefinition(
            key="unread",
            name="Unread",
            filters=[
                Filter(
                    connector="AND",
                    conditions=[FilterCondition(field_path="is_read", lookup_id="equals", value=False)],
                ),
            ],
        ),
    ],
)
INBOX_FOLDER_REGISTRY.register("EXAMPLE_ANNOUNCEMENTS", announcements)

All

ID all · Lookup ID ALL

All inbox items across all folders

FieldValue
iconfa fa-inbox
is_aggregateTrue
is_defaultTrue

Notifications

ID in_app_notifications · Lookup ID IN_APP_NOTIFICATIONS

All in-app notifications

FieldValue
iconfa fa-bell
is_aggregateFalse
is_defaultTrue

Emails

ID email · Lookup ID EMAIL

Emails from a connected email account

FieldValue
iconfa fa-envelope
source_modelbloomerp.EmailAccount
is_aggregateFalse
is_defaultFalse

Messages

ID instant_messaging · Lookup ID IM

Contains conversations

FieldValue
iconfa fa-message
is_aggregateFalse
is_defaultTrue