Skip to 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

Field Type Required Description Validators
doctype_name str DocType name of the shared document -
doc_id str ID or name of the document being shared -
shared_with str User ID or Role name to share with -
share_type ShareType Whether sharing with a user or role -
granted_permissions list[str] Permissions granted: read, write, delete, etc. -
note None Reason for sharing (for audit) -
Role Create Delete Read Write
Admin
Employee
Manager
Setting Value
Submittable False
Track Changes True

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