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.
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | Required | Stable ID identifying this folder type. |
documentation | str | '' | Markdown and tagged examples included in the generated developer reference. |
name | str | Required | Folder type name shown to users. |
description | Optional[str] | None | Summary of the folder type's purpose. |
item_type | Optional[InboxItemTypeDefinition] | None | Definition used to render and act on items in the folder. |
icon | Optional[str] | None | Icon shown for the folder type. |
filters | Union[list[InboxFolderTypeFilterDefinition], Callable[[Any], list[InboxFolderTypeFilterDefinition]], NoneType] | None | Declared or computed inbox filter presets. |
source_model | Optional[str] | None | Django model label for the original records, when applicable. |
actions | Optional[list[InboxActionDefinition]] | None | Actions available at the folder level. |
on_query | Callable[[dict[str, str], Any, bool], QuerySet] | default_query | Callback used to query the folder's items. |
is_aggregate | bool | False | Whether this folder combines items from other folders. |
aggregate_func | Optional[Callable[[Any], QuerySet]] | None | Callback that builds the aggregate item queryset. |
is_default | bool | False | Whether Bloomerp offers this type for default folder creation. |
default_sources | Optional[Annotated[list[InboxSignalSource | InboxJobSource | InboxEventSource], SkipValidation()]] | None | Jobs, events, or signals that contribute to folders of this type. |
on_group | Optional[Callable[[list[Any], QuerySet], list[InboxItemGroup]]] | None | Optional 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
| Field | Value |
|---|---|
icon | fa fa-inbox |
is_aggregate | True |
is_default | True |
Notifications
ID in_app_notifications · Lookup ID IN_APP_NOTIFICATIONS
All in-app notifications
| Field | Value |
|---|---|
icon | fa fa-bell |
is_aggregate | False |
is_default | True |
Emails
ID email · Lookup ID EMAIL
Emails from a connected email account
| Field | Value |
|---|---|
icon | fa fa-envelope |
source_model | bloomerp.EmailAccount |
is_aggregate | False |
is_default | False |
Messages
ID instant_messaging · Lookup ID IM
Contains conversations
| Field | Value |
|---|---|
icon | fa fa-message |
is_aggregate | False |
is_default | True |
