endi.views.project package

Submodules

endi.views.project.business module

Views related to Businesses

class endi.views.project.business.ProjectBusinessListView(*args, **kwargs)

Bases : BaseListView, TreeMixin

View listing businesses

property add_estimation_url
property add_invoice_url
add_template_vars = ('stream_actions', 'add_estimation_url', 'add_invoice_url', 'tva_display_mode', 'tva_on_margin')
children = []
current()
current_id()
dbsession: DBSESSION
default_direction = 'asc'
default_sort = 'name'
filter_closed(query, appstruct)
item_route_name = '/businesses/{id}'
query()

The main query, should be overrided by a subclass

request: Request
route_name = '/projects/{id}/businesses'
schema = None
session: ISession
sort_columns = {'created_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
stream_actions(item)
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
property tva_display_mode
property tva_on_margin: bool
endi.views.project.business.includeme(config)

endi.views.project.controller module

class endi.views.project.controller.BusinessData(id: int, type_: str, name: str, status: str, closed: bool, estimations: List[endi.views.project.controller.EstimationData] = <factory>, invoices: List[endi.views.project.controller.InvoiceData] = <factory>)

Bases : object

closed: bool
estimations: List[EstimationData]
classmethod from_model(model)
id: int
invoices: List[InvoiceData]
name: str
status: str
type_: str
class endi.views.project.controller.CustomerData(id: int, label: str)

Bases : object

id: int
label: str
class endi.views.project.controller.EstimationData(id: int, type_: str, name: str, status: str, business_type_id: str, internal_number: str, business_id: Union[int, NoneType] = None, customer: Union[endi.views.project.controller.CustomerData, NoneType] = None)

Bases : object

business_id: Optional[int] = None
business_type_id: str
customer: Optional[CustomerData] = None
classmethod from_model(model)
id: int
internal_number: str
name: str
status: str
type_: str
class endi.views.project.controller.InvoiceData(id: int, type_: str, name: str, status: str, business_type_id: str, business_id: int, official_number: str, customer: Union[endi.views.project.controller.CustomerData, NoneType] = None)

Bases : object

business_id: int
business_type_id: str
customer: Optional[CustomerData] = None
classmethod from_model(model)
id: int
name: str
official_number: str
status: str
type_: str
class endi.views.project.controller.NullClass

Bases : object

Class to be used as a placeholder for None

class endi.views.project.controller.ProjectAddEditController(request, edit=False)

Bases : BaseAddEditController

after_add_edit(project: Project, edit: bool, attributes: dict) Project

Post formatting Hook

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

  • edit – Is it an edit form ?

  • attributes – Validated attributes sent to this view

Renvoie:

The modified project

get_schema(submitted: dict) SQLAlchemySchemaNode
related_manager_factory

alias de ProjectRelatedAttrManager

class endi.views.project.controller.ProjectData(id: int, type_: str, name: str, estimations: List[endi.views.project.controller.EstimationData] = <factory>, invoices: List[endi.views.project.controller.InvoiceData] = <factory>, businesses: List[endi.views.project.controller.BusinessData] = <factory>)

Bases : object

businesses: List[BusinessData]
estimations: List[EstimationData]
classmethod from_model(model)
id: int
invoices: List[InvoiceData]
name: str
type_: str
class endi.views.project.controller.ProjectRelatedAttrManager(request)

Bases : RelatedAttrManager

class endi.views.project.controller.ProjectTreeController(request, project)

Bases : object

Controller getting the project tree with businesses and tasks

{

“id”: “name”: “estimations”: [{“id”: “….”}] “businesses”: [

{“id”: “….”, “estimations”: [{}..], “invoices:”[{}…]}

]

}

business_columns = [<sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>]
collection_get()

Build the project tree data object

estimation_columns = [<sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>]
get_all_project_nodes() List[Node]

Collect all the project related nodes (used by the zip files)

invoice_columns = [<sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>]
node_polymorphic_alias = <AliasedClass at 0x7fe5a5292c90; Node>

endi.views.project.estimation module

class endi.views.project.estimation.ProjectEstimationListView(*args, **kwargs)

Bases : CompanyEstimationList, TreeMixin

add_template_vars = ('title', 'is_admin', 'with_draft', 'stream_actions', 'main_actions', 'more_actions', 'add_url')
property add_url
children = []
dbsession: DBSESSION
filter_project(query, appstruct)
request: Request
route_name = '/projects/{id}/estimations'
schema = <endi.forms.lists.BaseListsSchema object at 140624087024592 (named )>
session: ISession
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”.

endi.views.project.estimation.includeme(config)

endi.views.project.files module

Attached files related views

class endi.views.project.files.ProjectFileAddView(*args, **kw)

Bases : FileUploadView, TreeMixin

children = []
dbsession: DBSESSION
redirect(come_from)

Build the redirection url

Can be overriden to specify a redirection

request: Request
route_name = '/projects/{id}/addfile'
session: ISession
class endi.views.project.files.ProjectFilesView(context, request=None)

Bases : BaseView, TreeMixin

children = []
get_project_id()
route_name = '/projects/{id}/files'
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
class endi.views.project.files.ProjectZipFileView(context, request=None)

Bases : BaseZipFileView

collect_files() List[File]

Collect the File objects to include in the archive

filename()
endi.views.project.files.business_py3o_list_view(request, context: Project) list

Return a list of available templates for a given business

endi.views.project.files.includeme(config)

endi.views.project.invoice module

endi.views.project.layout module

class endi.views.project.layout.ProjectLayout(context, request)

Bases : DefaultLayout

Layout for project related pages

Provide the main page structure for project view

property customer_labels
property details_url
property edit_url
property projectmenu
endi.views.project.layout.deferred_business_list_show_perms(item, kw)
endi.views.project.layout.deferred_phase_show_perms(item, kw)

Check if the phase menu should be shown

endi.views.project.layout.includeme(config)

endi.views.project.lists module

class endi.views.project.lists.ProjectListTools

Bases : object

filter_archived(query, appstruct)
filter_project_type(query, appstruct)
query() Iterable[Project]
class endi.views.project.lists.ProjectListView(*args, **kwargs)

Bases : ProjectListTools, BaseListView, TreeMixin

The project list view is compound of :
  • the list of projects with action buttons (view, delete …)

  • an action menu with:
    • links

    • an add projectform popup

    • a searchform

add_template_vars = ('title', 'stream_actions', 'add_url')
property add_url
children = []
dbsession: DBSESSION
default_direction = 'desc'
default_sort = 'created_at'
item_route_name = '/projects/{id}'
query()

The main query, should be overrided by a subclass

request: Request
route_name = '/companies/{id}/projects'
schema = <endi.forms.project.ProjectListSchema object at 140624295728400 (named )>
session: ISession
sort_columns = {'code': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'created_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
stream_actions(project)

Stream actions available for the given project

Paramètres:

project (obj) – A Project instance

Type renvoyé:

generator

title = 'Liste des dossiers'
property tree_url

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

The context can be either :

  • A Project

  • A Business

  • A Task

endi.views.project.lists.includeme(config)
endi.views.project.lists.redirect_to_customerslist(request, company)

Force project page to be redirected to customer page

endi.views.project.phase module

class endi.views.project.phase.PhaseAddFormView(context, request=None)

Bases : BaseFormView

dbsession: DBSESSION
request: Request
schema = <endi.forms.project.PhaseSchema object at 140624229509712 (named )>

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

session: ISession
submit_success(appstruct)
title = 'Ajouter un sous-dossier au dossier'
class endi.views.project.phase.PhaseEditFormView(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
request: Request
schema = <endi.forms.project.PhaseSchema object at 140624233418256 (named )>

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

session: ISession
submit_success(appstruct)
title = 'Modification du sous-dossier'
endi.views.project.phase.includeme(config)
endi.views.project.phase.phase_delete_view(context, request)

endi.views.project.project module

Project views Context could be either

Company - add view - list view

Project - view - add_phase - edit

class endi.views.project.project.ProjectAddStep2View(context, request=None)

Bases : BaseEditView, TreeMixin

add_template_vars = ('title', 'project_codes')
children = []
dbsession: DBSESSION
named_form_grid = ((('description', 6), ('code', 6)), (('starting_date', 6), ('ending_date', 6)), (('definition', 12),), (('business_types', 12),), (('mode', 12),))
property project_codes
redirect(appstruct)
request: Request
route_name = '/projects/{id}'
schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624295745232 (named )>

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

session: ISession
title
class endi.views.project.project.ProjectAddView(context, request=None)

Bases : BaseAddView, TreeMixin

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).

children = []
dbsession: DBSESSION
factory

alias de Project

msg = 'Le dossier a été ajouté avec succès'
named_form_grid = ((('name', 12),), (('project_type_id', 12),), (('customers', 12),))
on_add(new_model: Project, appstruct)
redirect(appstruct, new_model)
request: Request
route_name = '/companies/{id}/projects'
schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624295986320 (named )>

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

session: ISession
title = "Ajout d'un nouveau dossier"
class endi.views.project.project.ProjectEditView(context, request=None)

Bases : BaseEditView, TreeMixin

add_template_vars = ('project', 'project_codes')
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).

children = []
dbsession: DBSESSION
named_form_grid = ((('name', 12),), (('project_type_id', 12),), (('customers', 12),), (('description', 8), ('code', 4)), (('starting_date', 6), ('ending_date', 6)), (('definition', 12),), (('business_types', 12),), (('mode', 12),))
property project
property project_codes
redirect(appstruct)
request: Request
route_name = '/projects/{id}'
schema = <colanderalchemy.schema.SQLAlchemySchemaNode object at 140624295746512 (named )>

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

session: ISession
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”.

class endi.views.project.project.ProjectEntryPointView(context, request=None)

Bases : BaseView, TreeMixin

children = []
current()
route_name = '/projects/{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
class endi.views.project.project.ProjectGeneralView(context, request=None)

Bases : BaseView, TreeMixin

children = []
route_name = '/projects/{id}/general'
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
class endi.views.project.project.ProjectPhaseListView(context, request=None)

Bases : BaseView, TreeMixin

children = []
current_id()
route_name = '/projects/{id}/phases'
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.project.project.includeme(config)
endi.views.project.project.project_archive(request)

Archive the current project

endi.views.project.project.project_delete(request)

Delete the current project

endi.views.project.rest_api module

class endi.views.project.rest_api.BusinessTypeRestView(context, request=None)

Bases : RestListMixinClass, BaseRestView

BusinessType s REST view, scoped to company

GET /api/v1/companies/(int: company_id)/business_types

Returns the business types of a given company company_id allowed for the current authenticated user

Paramètres de requête:
  • project_type_id – Filter by associated project type id

GET /api/v1/business_types/(int: business_types_id)

Return a more descriptive json representation of the business type

collection_get()

Collection HTTP GET method endpoint

dbsession: DBSESSION
filter_project_type_id(query, appstruct)
list_schema

alias de APIBusinessListSchema

query() Iterable[BusinessType]

The main query, should be overrided by a subclass

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

Bases : BaseRestView

Project Phase (subdir) REST view, scoped to project

GET /api/v1/projects/(project_id)/phases

Returns the phases of a given project

Paramètres de requête:
  • int – project_id (required) – The id of the project

collection_get()
dbsession: DBSESSION
request: Request
session: ISession
class endi.views.project.rest_api.ProjectRestView(context, request=None)

Bases : RestListMixinClass, BaseRestView

Projects REST view, scoped to company

GET /api/v1/companies/(int: company_id)/projects

Returns the projects of a given company

Paramètres de requête:
  • search – Filter the name of the project containing the search string

  • customer_id – Filter projects attached to the given customer

  • form_config – Return the options used to build new projects (available

options for the given company, form schema …)

GET /api/v1/projects/(int: project_id)

Return the project with id project_id in json format

Paramètres de requête:
  • related – List of related objects we want to be added to the response

dbsession: DBSESSION
filter_archived(query, appstruct)
filter_customer_id(query, appstruct)
form_config() dict

Collect informations necessary to build the project add form

format_collection(query)

Format the collection returned to the end user

result of HTTP GET call on the collection endpoint

format_item_result(item)

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) SQLAlchemySchemaNode

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

alias de APIProjectListSchema

post_format(entry, edit, attributes)

Associate a newly created element to the parent company

query() Iterable[Project]

The main query, should be overrided by a subclass

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

Bases : BaseRestView

Rest entry point for getting the project tree management

collection_get()
controller_class

alias de ProjectTreeController

dbsession: DBSESSION
form_config()
request: Request
session: ISession
class endi.views.project.rest_api.ProjectTypeRestView(context, request=None)

Bases : BaseRestView

ProjectType s REST view, scoped to company

GET /api/v1/companies/(int: company_id)/project_types

The project types of a given company allowed for the given user

GET /api/v1/project_types/(project_type_id)

Return a more descriptive json representation of the project type

collection_get()
dbsession: DBSESSION
get()

End point for HTTP GET calls

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

endi.views.project.routes module

endi.views.project.routes.includeme(config)

Module contents

endi.views.project.includeme(config)