endi.views.third_party.customer package

Submodules

endi.views.third_party.customer.base module

endi.views.third_party.customer.base.get_customer_url(request, customer=None, _query={}, suffix='', api=False, _anchor=None, absolute=False)
endi.views.third_party.customer.base.get_edit_btn(customer_id)
endi.views.third_party.customer.base.get_list_view_btn(id_)
endi.views.third_party.customer.base.get_view_btn(customer_id)
endi.views.third_party.customer.base.populate_actionmenu(request, context=None)

populate the actionmenu for the different views (list/add/edit …)

endi.views.third_party.customer.controller module

class endi.views.third_party.customer.controller.CustomerAddEditController(request, edit=False)

Bases : BaseAddEditController

after_add_edit(customer: Customer, edit: bool, attributes: dict) Customer

Post formatting Hook

Paramètres:
  • customer (Customer) – Current customer (added/edited)

  • edit (bool) – Is it an edit form ?

  • attributes (dict) – Validated attributes sent to this view

Renvoie:

The modified customer

Type renvoyé:

Customer

get_available_types() Iterable[Dict]

Renvoie les types de client que l’on peut créer

get_company_schema() SQLAlchemySchemaNode
get_customer_type(submitted: dict) str
get_default_type() str

Find the default customer type to provide by default

Renvoie:

The name of the type

Type renvoyé:

str

get_individual_schema() SQLAlchemySchemaNode
get_internal_schema() SQLAlchemySchemaNode
get_schema(submitted: dict) Schema

Build and cache the current schema

get_schemas() Dict[str, Schema]

Renvoie les schémas disponibles

Renvoie:

Liste des schémas colander

Type renvoyé:

Dict[str, colander.Schema]

related_manager_factory

alias de CustomerRelatedAttrManager

class endi.views.third_party.customer.controller.CustomerRelatedAttrManager(request)

Bases : RelatedAttrManager

endi.views.third_party.customer.lists module

Customer views

class endi.views.third_party.customer.lists.CustomersCsv(*args, **kwargs)

Bases : CustomersListTools, BaseCsvView

Customer csv view

dbsession: DBSESSION
property filename

To be implemented by the subclass

model

alias de Customer

query()

The main query, should be overrided by a subclass

request: Request
session: ISession
class endi.views.third_party.customer.lists.CustomersListTools

Bases : object

Customer list tools

default_direction = 'desc'
default_sort = 'created_at'
filter_archived(query, appstruct)
filter_name_or_contact(records, appstruct)

Filter the records by customer name or contact lastname

filter_type(query, appstruct)
query()
schema = <endi.forms.lists.BaseListsSchema object at 140624255045392 (named )>
sort_columns = {'code': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'created_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'label': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'lastname': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
title = 'Liste des clients'
class endi.views.third_party.customer.lists.CustomersListView(*args, **kwargs)

Bases : CustomersListTools, BaseListView, TreeMixin

Customer listing view

add_template_vars = ('stream_actions', 'title', 'stream_main_actions', 'stream_more_actions')
children = []
item_route_name = 'customer'
route_name = '/companies/{id}/customers'
stream_actions(customer)

Return action buttons with permission handling

stream_main_actions()
stream_more_actions()
property tree_url

Compile the url to be used in the breadcrumb for this view

The context can be either :

  • A Company

  • A Customer

  • A Task

endi.views.third_party.customer.lists.includeme(config)

endi.views.third_party.customer.rest_api module

class endi.views.third_party.customer.rest_api.CustomerRestView(context, request=None)

Bases : RestListMixinClass, CustomersListTools, BaseRestView

Customer rest view

collection : context Root

GET : return list of customers (company_id should be provided)

civilite_options() List[Dict]
controller_class

alias de CustomerAddEditController

dbsession: DBSESSION
default_customer_type() str

Collect the default user type

Renvoie:

One of the available customer type (company/individual)

Type renvoyé:

str

form_config()
format_collection(query)

Format the collection returned to the end user

result of HTTP GET call on the collection endpoint

format_item_result(model)

Build the data to be returned by the api endpoint

Paramètres:

item – The current sqlalchemy Model

Renvoie:

An object with a __json__ method or a dict that can be json serialized

get_schema(submitted: dict) Schema

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

list_schema = <endi.forms.lists.BaseListsSchema object at 140624254640464 (named )>
post_format(entry, edit, attributes)

Associate a newly created element to the parent company

query()

The main query, should be overrided by a subclass

request: Request
session: ISession
endi.views.third_party.customer.rest_api.includeme(config)

endi.views.third_party.customer.routes module

endi.views.third_party.customer.routes.includeme(config)

endi.views.third_party.customer.views module

Module contents

endi.views.third_party.customer.includeme(config)