Metadata-Version: 2.5
Name: trytond_score
Version: 8.0.0.2
Summary: Score Workflow Engine
Author: Clemens Hupka
Maintainer-email: Clemens Hupka <clemens.hupka@backend.at>
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Keywords: engine,process,score,tryton,workflow
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Requires-Python: >=3.10
Requires-Dist: trytond-company<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Description-Content-Type: text/x-rst

Score Module
============

The ``score`` module provides a persistent, admin-configurable workflow
engine for Tryton.  A workflow is defined as a state machine of states,
transitions, guards and ordered actions, and is bound to any model whose
``state`` field remains authoritative.  This makes it possible to drive
models that already own their state selection, instead of replacing it.

The engine integrates with the Tryton core: events are dispatched through
``ir.trigger``, deferred transitions run through ``ir.queue``, time based
maintenance runs through ``ir.cron``, changes are published on ``bus`` and
instance numbering uses ``ir.sequence``.

A business model adopts the engine with the ``ScoreWorkflow`` mixin: the
button the mixin declares opens a chooser of the transitions a record may
fire, so that a client fires transitions of a definition it knows nothing
about, and the changes an instance performs are published on the ``bus`` of
the core, so that a client which follows a record refreshes it without
polling it.

A model that already declares its state machine through the core
``Workflow`` mixin (``_transitions``, ``_transition_state`` and the methods
decorated by ``@Workflow.transition``) can be pointed at the engine without
being rewritten: the engine reads the machine from the code, drives it
through the methods the code already implements, and
``score.workflow.import_from_model()`` turns it into a draft definition
when the deployment is ready to author and publish one.

Running instances pin an immutable workflow revision, so editing a
definition never affects work that is already in flight.  Every transition
is recorded in an append-only history which is the substrate for cycle time
and bottleneck reporting.

The state machine of a definition is drawn as a directed graph on the form
of a workflow, with the renderer the core uses for the machines a model
declares in code: the states are nodes and the transitions edges, so that a
designer reviews the machine he authored and a support engineer reads the
machine a record runs through.  The rendering is a soft dependency of the
module: it needs ``pydot`` and graphviz, and nothing else does.

What the engine leaves to the deployment - the drain of the firings an
asynchronous workflow deferred to ``ir.queue``, the flagging of the running
instances that stopped moving and the cancellation of the runs a deployment
gave up on - runs as three jobs of ``ir.cron``, which the module ships
deactivated so that a deployment enables and times them itself.  Their
thresholds are settings of the module's configuration.
