endi.views.status package

Submodules

endi.views.status.rest_api module

class endi.views.status.rest_api.StatusLogEntryRestView(context, request=None)

Bases : BaseRestView

For StatusLogEntry (Mémo) with a parent model inheriting Node.

We expect context to hold a statuses attr with all status log entries.

after_flush(entry, edit, attributes)

Allows to modify datas after the main entry was flushed

HTTP POST and PUT calls

Paramètres:
  • entry – The instance added/edited

  • edit (bool) – Is it an edition view ?

  • attributes (dict) – The validated submitted data

collection_get()
dbsession: DBSESSION
get_node_url(node)

Build the url to access the given node from the notification

get_schema(submitted)

Build the colander schema to be used

Paramètres:

submitted – Data submitted to the api endpoint

Renvoie:

A form schema used to validate the submitted data

notify_on_status_log_entry(entry: StatusLogEntry, edit: bool, attributes: dict)

Notify users when a mémo is added on a node

recipients are selected when adding the memo (StatusLogEntry)

post_format(entry: StatusLogEntry, edit: bool, attributes)

Allows to apply post formatting to the model before flushing it

HTTP POST and PUT calls

Paramètres:
  • entry – The instance added/edited

  • edit (bool) – Is it an edition view ?

  • attributes (dict) – The validated submitted data

request: Request
session: ISession
endi.views.status.rest_api.get_other_users_for_notification(request, node) List[dict]

Find users that may be notified if a memo is added to the node

endi.views.status.rest_api.user_json_repr_for_select(users: List[User]) List[dict]

Return a list of dicts with the user id and the user label

endi.views.status.utils module

endi.views.status.utils.get_visibility_options(request: Request) dict

Module contents

Status change related views

Common to :

Estimation Invoice CancelInvoice ExpenseSheet

class endi.views.status.StatusView(context, request=None)

Bases : BaseView

View for status handling

See the call method for the workflow and the params passed to the methods

check_allowed(status)

Check that the status change is allowed

Paramètres:

status (str) – The new status that should be affected

Type renvoyé:

bool

Raises:

Forbidden exception if the action isn’t allowed

format_params(params: dict)

Treat the status related parameters

get_redirect_url()

Return default URL to be redirected after status change

To be overriden

notify(status: str, params: dict)

Notify the change to the registry

Paramètres:
  • status (str) – The new status that was affected

  • params (dict) – The submitted data transmitted with status change

post_status_process(status, params)

Launch post status process functions

Paramètres:
  • status (str) – The new status that should be affected

  • params (dict) – The params that were transmitted by the associated

State’s callback

pre_status_process(status, params)

Launch pre process functions

redirect()

Redirect function to be used after status processing

set_status(status, params)

Set the new status to the given item handle pre_status and post_status processing

Paramètres:
  • status (str) – The new status that should be affected

  • params (str) – The params retrieved from the request

status_process(status, params)

Definitively Set the status of the element

Paramètres:
  • status (str) – The new status that should be affected

  • params (dict) – The params that were transmitted by the pre_process

function

valid_msg = 'Le statut a bien été modifié'