endi.views.expenses package

Submodules

endi.views.expenses.bookmarks module

class endi.views.expenses.bookmarks.BookMarkHandler(request)

Bases : object

Wrapper for expense bookmarks

delete(id_)

Removes a bookmark

load_bookmarks_from_current_request()
refresh()
store(item)

Store a bookmark (add/edit) :@param item: a dictionnary with the bookmark informations

endi.views.expenses.bookmarks.get_bookmarks(request)

Return the user’s bookmarks

endi.views.expenses.expense module

Expense handling view

class endi.views.expenses.expense.ExpenseSheetAddView(context, request=None)

Bases : BaseFormView

A simple expense sheet add view

before(form)

Performs some processing on the form prior to rendering.

By default, this method does nothing. Override this method in your dervived class to modify the form. Your function will be executed immediately after instansiating the form instance in __call__() (thus before obtaining widget resources, considering buttons, or rendering).

create_instance(appstruct)

Create a new expense sheet instance

dbsession: DBSESSION
redirect(sheet)
request: Request
schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624116803664 (named )>

Colander schema instance to be used to create the form instance. Provide your schema in your derived class.

session: ISession
submit_failure(e)

Called by default when we failed to submit the values We add a token here for forms that are collapsed by default to keep them open if there is an error

submit_success(appstruct)
property title
class endi.views.expenses.expense.ExpenseSheetDeleteView(context, request=None)

Bases : DeleteView

Expense deletion view

Current context is an expensesheet

dbsession: DBSESSION
delete_msg = 'La note de dépenses a bien été supprimée'
redirect()
request: Request
session: ISession
class endi.views.expenses.expense.ExpenseSheetDuplicateView(context, request=None)

Bases : BaseFormView

before(form)

Performs some processing on the form prior to rendering.

By default, this method does nothing. Override this method in your dervived class to modify the form. Your function will be executed immediately after instansiating the form instance in __call__() (thus before obtaining widget resources, considering buttons, or rendering).

dbsession: DBSESSION
form_options = (('formid', 'duplicate_form'),)

Two-tuple of options to pass as keyword arguments when instantiating the form instance of form_class. Any options that can be passed to this class” __init__ can be provided here.

redirect(sheet)
request: Request
schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624114582160 (named )>

Colander schema instance to be used to create the form instance. Provide your schema in your derived class.

session: ISession
submit_failure(e)

Called by default when we failed to submit the values We add a token here for forms that are collapsed by default to keep them open if there is an error

submit_success(appstruct)
property title
class endi.views.expenses.expense.ExpenseSheetEditInfosView(context, request=None)

Bases : BaseFormView

Expense sheet edit infos (year, month, title) view

before(form)

Performs some processing on the form prior to rendering.

By default, this method does nothing. Override this method in your dervived class to modify the form. Your function will be executed immediately after instansiating the form instance in __call__() (thus before obtaining widget resources, considering buttons, or rendering).

dbsession: DBSESSION
redirect(sheet)
request: Request
schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624114981072 (named )>

Colander schema instance to be used to create the form instance. Provide your schema in your derived class.

session: ISession
submit_failure(e)

Called by default when we failed to submit the values We add a token here for forms that are collapsed by default to keep them open if there is an error

submit_success(appstruct)
property title
class endi.views.expenses.expense.ExpenseSheetEditView(context, request=None)

Bases : BaseView, JsAppViewMixin, TreeMixin

children = []
context_url(_query: Dict[str, str] = {})
current()

Renvoie le contexte pour la génération des informations de breadcrumb (title, tree_url)

more_js_app_options()

Add options passed to the AppOption object

route_name = '/expenses/{id}'
property title

str(object=””) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to “strict”.

property tree_url
endi.views.expenses.expense.add_routes(config)

Add module’s related routes

endi.views.expenses.expense.excel_filename(request)

return an excel filename based on the request context

endi.views.expenses.expense.get_expense_sheet(year, month, cid, uid)

Return the expense sheet for the given 4-uple

endi.views.expenses.expense.get_formatted_user_vehicle_information_sentence(vehicle_fiscal_power, vehicle_registration)

Return a formatted sentence with vehicle information :param vehicle_fiscal_power: :param vehicle_registration: :return: String

endi.views.expenses.expense.get_new_expense_sheet(year, month, title, cid, uid)

Return a new expense sheet for the given 4-uple

endi.views.expenses.expense.get_redirect_btn(request, id_)

Button for « go back to project » link

endi.views.expenses.expense.includeme(config)

Declare all the routes and views related to this module

endi.views.expenses.expense.populate_actionmenu(request, tolist=False)

Add buttons in the request actionmenu attribute

endi.views.expenses.lists module

endi.views.expenses.rest_api module

class endi.views.expenses.rest_api.ExpenseStatusLogEntry(context, request=None)

Bases : StatusLogEntryRestView

dbsession: DBSESSION
get_node_url(node)

Build the url to access the given node from the notification

request: Request
session: ISession
class endi.views.expenses.rest_api.RestBookMarkView(context, request=None)

Bases : BaseView

Json rest-api for expense bookmarks handling

delete()

Removes a bookmark

get()

Rest GET Method : get

post()

Rest POST method : add

put()

Rest PUT method : edit

property schema
class endi.views.expenses.rest_api.RestExpenseJustifiedStatusView(context, request=None)

Bases : StatusView

Common between Line / Sheet

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

log_sheet_status(sheet, status, params)
notify_sheet_status(sheet, status)
redirect()

Redirect function to be used after status processing

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

class endi.views.expenses.rest_api.RestExpenseKmLineView(context, request=None)

Bases : BaseRestView

Base rest view for expense line handling

after_flush(entry, edit, attributes)

Compute ht amount of the km line

collection_get()
dbsession: DBSESSION
duplicate()

Duplicate an expense line to an existing ExpenseSheet

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

post_format(entry, edit, attributes)

Associate a newly created element to the parent task

request: Request
session: ISession
class endi.views.expenses.rest_api.RestExpenseLineJustifiedStatusView(context, request=None)

Bases : RestExpenseJustifiedStatusView

notify(status, params)

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

class endi.views.expenses.rest_api.RestExpenseLineView(context, request=None)

Bases : BaseRestView

Base rest view for expense line handling

collection_get()
dbsession: DBSESSION
duplicate()

Duplicate an expense line to an existing ExpenseSheet

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

post_format(entry, edit, attributes)

Associate a newly created element to the parent sheet

request: Request
session: ISession
unset_justified_on_edit(entry)
class endi.views.expenses.rest_api.RestExpenseSheetJustifiedStatusView(context, request=None)

Bases : RestExpenseJustifiedStatusView

notify(status, params)

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

class endi.views.expenses.rest_api.RestExpenseSheetStatusView(context, request=None)

Bases : StatusView

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

get_redirect_url()

Return default URL to be redirected after status change

To be overriden

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

class endi.views.expenses.rest_api.RestExpenseSheetView(context, request=None)

Bases : BaseRestView

dbsession: DBSESSION
factory

alias de ExpenseSheet

form_config()

Form display options

Renvoie:

The sections that the end user can edit, the options

available for the different select boxes

get_schema(submitted)

Return the schema for ExpenseSheet add

Paramètres:

submitted (dict) – The submitted datas

Renvoie:

A colander.Schema

post_format(entry, edit, attributes)

Add the company and user id after sheet add

request: Request
session: ISession
endi.views.expenses.rest_api.add_routes(config)

Add module’s related routes

endi.views.expenses.rest_api.add_views(config)

Add rest api views

endi.views.expenses.rest_api.includeme(config)

endi.views.expenses.utils module

endi.views.expenses.utils.get_payment_form(request, counter=None)

Return a payment form object

Module contents

endi.views.expenses.includeme(config)