Skip to main content

DocumentShare

Explicit share of a document with a user or role.

Enables fine-grained document-level sharing beyond the default
owner-based or team-based RLS.

Attributes:
doctype_name: The DocType being shared (e.g., "Invoice")
doc_id: Document identifier (e.g., "INV-001" or UUID)
shared_with: User ID or Role name to share with
share_type: Whether sharing with USER or ROLE
granted_permissions: List of permissions granted (e.g., ["read", "write"])
note: Optional note explaining why the share was created

Source: document_share.py

Fields

FieldTypeRequiredDescriptionValidators
doctype_namestrDocType name of the shared document-
doc_idstrID or name of the document being shared-
shared_withstrUser ID or Role name to share with-
share_typeShareTypeWhether sharing with a user or role-
granted_permissionslist[str]Permissions granted: read, write, delete, etc.-
notestrNoneReason for sharing (for audit)

Permissions

RoleCreateDeleteReadWrite
Admin
Employee
Manager

Configuration

SettingValue
SubmittableFalse
Track ChangesTrue

Controller

Controller hooks are implemented in *_controller.py files. Available lifecycle hooks:

  • validate() - Called before save, raise exceptions for validation errors
  • before_insert() - Called before inserting a new document
  • after_insert() - Called after successfully inserting
  • before_save() - Called before saving (insert or update)
  • after_save() - Called after saving
  • before_delete() - Called before deleting
  • after_delete() - Called after deleting