Built-ins
ObjectActionDefinition
Describe an action for a record on its detail page or in a dataview.
Callbacks receive the request, model, content type, and accessible record
in ObjectActionContext. For a row action, context.dataview also contains
the originating dataview. Register the definition using its ID as the key.
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | Required | Stable ID used in action configuration.Minimum length: 1 |
documentation | str | '' | Markdown and tagged examples included in the generated developer reference. |
models | ModelSelector | '__all__' | Model scope. Use a Django model class, a list of classes, 'all', or a zero-argument callable returning one of those selectors. Use None or an empty list for no models. |
methods | tuple[Literal['GET', 'POST'], ...] | ('GET', 'POST') | Allowed HTTP methods. The first is used by the action button.Minimum length: 1 |
method | Optional[Literal['GET', 'POST']] | None | Legacy single-method override for existing action definitions. |
description | str | '' | The description of the action. |
label | str | None | None | Optional label for the action. |
icon | str | None | None | Optional Font Awesome icon for the action. |
shortcut | str | None | None | Optional keyboard shortcut, such as 'alt+arrowright' (Alt + Right Arrow), or a sequence like 'k then p'. |
get_button_attrs | Callable[[ObjectActionContext], dict[str, Any]] | BaseActionDefinition.<lambda> | Return additional HTML attributes for the default action button. |
get_query_params | Callable[[ObjectActionContext], ActionQueryParams] | None | None | Return query parameters for the default action button's URL. A sequence gives repeated values. Object actions add no extra parameters by default. Dataview HTMX actions use live filters and selection by default. For a custom HTMX URL, supply a callback to use its own query parameters, or return an empty mapping to leave the URL as supplied. Registered action handlers still receive their source dataview context. |
is_visible | Callable[[ObjectActionContext], bool] | BaseActionDefinition.<lambda> | Determine whether to show the action in the current context. |
execute | Callable[[ObjectActionContext], HttpResponse | StreamingHttpResponse | None] | None | None | Handler for an action request. HTML-only controls can omit it. |
success_message | str | None | None | Message shown when the handler returns no response. |
refresh_on_success | Optional[Literal['item', 'dataview']] | None | Refresh the originating record or dataview when the handler returns no response. |
render | Callable[[ObjectActionContext, Mapping[str, Any]], str] | None | None | Return an HTML fragment using the action context and surrounding template context. The template context includes the current definition under 'action'. |
Show the record ID
Add example-show-record-id to a model's object action list.
from django.http import HttpResponse
from bloomerp.actions import OBJECT_ACTION_REGISTRY
from bloomerp.actions.definition import ObjectActionContext, ObjectActionDefinition
from bloomerp.utils.requests import render_message
def show_record_id(context: ObjectActionContext) -> HttpResponse:
'''Show the primary key of the current record.'''
return render_message(context.request, f"Record ID: {context.object.pk}", "info")
show_id = ObjectActionDefinition(
id="example-show-record-id",
label="Show record ID",
description="Display the primary key of the current record.",
execute=show_record_id,
)
OBJECT_ACTION_REGISTRY.register(show_id.id, show_id)Open a workspace in a new tab
Set models to the model that supplies the destination URL.
from bloomerp.actions import OBJECT_ACTION_REGISTRY
from bloomerp.actions.definition import ObjectActionContext, ObjectActionDefinition
from bloomerp.models.workspaces import Workspace
def workspace_link(context: ObjectActionContext) -> dict[str, str]:
'''Return the attributes for an ordinary link to the workspace.'''
return {"href": context.object.get_absolute_url(), "target": "_blank", "rel": "noopener"}
open_workspace = ObjectActionDefinition(
id="example-open-workspace-tab",
label="Open in new tab",
description="Open this workspace in a new browser tab.",
models=Workspace,
get_button_attrs=workspace_link,
)
OBJECT_ACTION_REGISTRY.register(open_workspace.id, open_workspace)Activity
ID activity
Show changes recorded for this record in its detail sidebar.
Models All models
| Field | Value |
|---|---|
icon | fa fa-history |
shortcut | d then a |
Comments
ID comments
Open the conversation attached to this record in its detail sidebar.
Models All models
| Field | Value |
|---|---|
icon | fa fa-comments |
shortcut | d then m |
Create Todo
ID create-todo
Open a Todo form with the current record as its linked object.
Models All models
| Field | Value |
|---|---|
icon | fa fa-list-check |
shortcut | d then t |
Contact
ID contact
Show available communication options for readable contact fields.
Models All models
| Field | Value |
|---|---|
icon | fa fa-address-book |
shortcut | d then c |
workflow-actions
ID workflow-actions
Show eligible workflows for the selected record.
Models All models
Execute
ID execute_sql_query
Execute the saved SQL query and show its results.
Models bloomerp.sqlquery
| Field | Value |
|---|---|
method | GET |
icon | fa-solid fa-play |
Open workspace
ID open-workspace
Open the selected workspace in the main content area.
Models bloomerp.workspace
Revoke API Key
ID revoke_api_key
Revoke an active API key and refresh the current page.
Models bloomerp.apikey
| Field | Value |
|---|---|
method | POST |
icon | fa fa-solid fa-xmark |
View
ID view_file
Preview the file in the shared drawer.
Models bloomerp.filenode
ID email
Open the email composer with the file attached.
Models bloomerp.filenode
Rename
ID rename_file
Open the form for changing the file's display name.
Models bloomerp.filenode
Move
ID move_file
Open the form for moving the file to another folder.
Models bloomerp.filenode
Delete
ID delete_file
Open the confirmation for deleting an unused file.
Models bloomerp.filenode
Sign
ID sign_file
Open the signing wizard for this PDF.
Models bloomerp.filenode
Generate document
ID generate-document
Open generation with the embedding record selected.
Models bloomerp.documenttemplate
| Field | Value |
|---|---|
icon | fa-solid fa-file |
Assign
ID assign
Open the form for assigning recipients to the signature request.
Models bloomerp.signaturerequest
| Field | Value |
|---|---|
icon | fa-solid fa-user-plus |
Send
ID send
Open the form for sending the signature request to its recipients.
Models bloomerp.signaturerequest
| Field | Value |
|---|---|
icon | fa-regular fa-paper-plane |
signing_links
ID signing_links
Show links for authorized recipients to sign the document.
Models bloomerp.signaturerequest
Sign
ID sign
Open the signing form for the current recipient.
Models bloomerp.signaturerequest
| Field | Value |
|---|---|
icon | fa-solid fa-signature |
form_links
ID form_links
Show the available links for this form.
Models bloomerp.form
public_embed
ID public_embed
Show the embed code for a form that allows embedding.
Models bloomerp.form
Persist
ID persist
Persist the data from the reviewed form submission.
Models bloomerp.formsubmission
| Field | Value |
|---|---|
method | POST |
Synchronize phone numbers
ID synchronize_numbers
Synchronize phone numbers from this connection's carrier.
Models bloomerp.voipconnection
| Field | Value |
|---|---|
method | POST |
icon | fa-solid fa-rotate |
Copy booking link
ID share_booking_link
Copy the public booking URL for this record to the clipboard.
Models bloomerp.bookinglink
| Field | Value |
|---|---|
icon | fa-solid fa-link |
Approve booking
ID approve_booking
Approve a pending booking and refresh its row.
Models bloomerp.bookinglinksubmission
| Field | Value |
|---|---|
method | POST |
icon | fa-solid fa-check |
Reply to invitation
ID reply_invitation
Open the attendance form for the invited participant.
Models bloomerp.calendarevent
Run workflow
ID run_workflow
Open the form to run the selected workflow.
Models bloomerp.workflow
Approve
ID approve_step
Open the continuation approval form for a paused workflow run.
Models bloomerp.workflowrun
Edit
ID edit-revision
Open this tutorial revision in the editor.
Models bloomerp.tutorialrevision
| Field | Value |
|---|---|
icon | fa-solid fa-pen |
Publish
ID publish-revision
Publish the selected tutorial revision.
Models bloomerp.tutorialrevision
| Field | Value |
|---|---|
method | POST |
icon | fa-solid fa-upload |
Start tutorial
ID start-tutorial
Start the published walkthrough for this tutorial.
Models bloomerp.tutorial
| Field | Value |
|---|---|
icon | fa-solid fa-play |
Create revision
ID create-revision
Open the form to create a new revision of this tutorial.
Models bloomerp.tutorial
| Field | Value |
|---|---|
icon | fa-solid fa-plus |
Revisions
ID revisions
Open the dataview of revisions belonging to this tutorial.
Models bloomerp.tutorial
| Field | Value |
|---|---|
icon | fa-solid fa-list |
