endi.views.task package¶
Submodules¶
endi.views.task.pdf_rendering_service module¶
Task rendering service
Base service used to render Task in PDF format
- class endi.views.task.pdf_rendering_service.TaskPdfFromHtmlService(context, request)¶
Bases :
TaskRawPdfFromHtmlServiceThis class implements the
endi.interfaces.ITaskPdfRenderingServiceIt extends the TaskRawPdfFromHtmlService by adding FacturX information to the generated PDF.
- render()¶
Render the current context in pdf format
- Type renvoyé:
instance of
io.BytesIO
- class endi.views.task.pdf_rendering_service.TaskRawPdfFromHtmlService(context, request)¶
Bases :
objectThis class implements the
endi.interfaces.ITaskPdfRenderingService- filename()¶
- render()¶
Render the current context in pdf format
- Type renvoyé:
instance of
io.BytesIO
endi.views.task.pdf_storage_service module¶
Pdf storage service implementation (interface ITaskPdfStorageService)
- class endi.views.task.pdf_storage_service.PdfDevStorageService(context, request)¶
Bases :
object- get_bulk_pdf(tasks)¶
- retrieve_pdf()¶
- set_task(task)¶
- store_pdf(filename, pdf_buffer)¶
- class endi.views.task.pdf_storage_service.PdfFileDepotStorageService(context, request)¶
Bases :
objectThis class implements the
endi.interfaces.ITaskPdfStorageService- get_bulk_pdf(tasks)¶
Produce a Large pdf containing the pdf of all given tasks Excludes CGV related informations
- Paramètres:
tasks (list) – List of Task instances
- Renvoie:
A pdf as a bytes data buffer
- retrieve_pdf()¶
Retrieve the pdf and returns it as a data buffer
- set_task(task)¶
Set task (if it’s different from the current context)
- store_pdf(filename, pdf_buffer)¶
Stores the pdf on disk if needed
- Paramètres:
pdf_buffer (obj) – instance of
io.BytesIOfilename (str) – The name of the pdf file
endi.views.task.rest_api module¶
- class endi.views.task.rest_api.DiscountLineRestView(context, request=None)¶
Bases :
BaseRestViewRest views used to handle the task lines
Collection views : Context Task
GET
Return all the items belonging to the parent task
POST
Add a new item
Item views
GET
Return the Item
PUT/PATCH
Edit the item
DELETE
Delete the item
- after_flush(entry, edit, attributes)¶
Allows to modify datas after the main entry was flushed
HTTP POST and PUT calls
- collection_get()¶
View returning the task line groups attached to this estimation
- dbsession: DBSESSION¶
- get_schema(submitted)¶
Return the schema for DiscountLine add/edition
- Paramètres:
submitted (dict) – The submitted datas
- Renvoie:
A colander.Schema
- on_delete()¶
- post_format(entry, edit, attributes)¶
Associate a newly created element to the parent task after edition
- post_percent_discount_view()¶
View handling percent discount configuration
Generates discounts for each tva used in this document
current context : Invoice/Estimation/CancelInvoice
- request: Request¶
- session: ISession¶
- class endi.views.task.rest_api.PostTTCLineRestView(context, request=None)¶
Bases :
BaseRestViewRest views used to handle the task lines
Collection views : Context Task
GET
Return all the items belonging to the parent task
POST
Add a new item
Item views
GET
Return the Item
PUT/PATCH
Edit the item
DELETE
Delete the item
- after_flush(entry, edit, attributes)¶
Allows to modify datas after the main entry was flushed
HTTP POST and PUT calls
- collection_get()¶
View returning the task line groups attached to this estimation
- dbsession: DBSESSION¶
- get_schema(submitted)¶
Return the schema for PostTTCLine add/edition
- Paramètres:
submitted (dict) – The submitted datas
- Renvoie:
A colander.Schema
- on_delete()¶
- post_format(entry, edit, attributes)¶
Associate a newly created element to the parent task after edition
- request: Request¶
- session: ISession¶
- class endi.views.task.rest_api.TaskAddRestView(context, request=None)¶
Bases :
BaseRestViewRest api used to add a new task
- class GetParamsSchema(*args, **kw)¶
Bases :
Schema
- dbsession: DBSESSION¶
- get_schema(submitted: Optional[dict] = None) 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
- option_urls()¶
- put()¶
HTTP PUT api endpoint
- request: Request¶
- session: ISession¶
- class endi.views.task.rest_api.TaskFileRequirementRestView(context, request=None)¶
Bases :
BaseRestView- collection_get()¶
- dbsession: DBSESSION¶
- get()¶
End point for HTTP GET calls
- request: Request¶
- session: ISession¶
- validation_status()¶
- class endi.views.task.rest_api.TaskLineGroupRestView(context, request=None)¶
Bases :
BaseRestViewRest views handling the task line groups
Collection views : Context Task
GET
Return all the items belonging to the parent task
POST
Add a new item
Item views
GET
Return the Item
PUT/PATCH
Edit the item
DELETE
Delete the item
- collection_get()¶
View returning the task line groups attached to this estimation
- dbsession: DBSESSION¶
- get_schema(submitted)¶
Return the schema for TaskLineGroup add/edition
- Paramètres:
submitted (dict) – The submitted datas
- Renvoie:
A colander.Schema
- on_delete()¶
- post_format(entry, edit, attributes)¶
Associate a newly created element to the parent task
- post_load_groups_from_catalog_view()¶
View handling product group loading
expects sale_product_group_ids: [id1, id2] as json POST params
- request: Request¶
- session: ISession¶
- class endi.views.task.rest_api.TaskLineRestView(context, request=None)¶
Bases :
BaseRestViewRest views used to handle the task lines
Collection views : Context Task
GET
Return all the items belonging to the parent task
POST
Add a new item
Item views
GET
Return the Item
PUT/PATCH
Edit the item
DELETE
Delete the item
- after_flush(entry, edit, attributes)¶
Allows to modify datas after the main entry was flushed
HTTP POST and PUT calls
- collection_get()¶
- dbsession: DBSESSION¶
- get_schema(submitted)¶
Return the schema for TaskLine add/edition
- Paramètres:
submitted (dict) – The submitted datas
- Renvoie:
A colander.Schema
- on_delete()¶
- post_format(entry, edit, attributes)¶
Associate a newly created element to the parent group
- post_load_from_catalog_view()¶
View handling sale_product loading
expects sale_product_ids: [id1, id2] as json POST params
- request: Request¶
- session: ISession¶
- class endi.views.task.rest_api.TaskRestView(context, request=None)¶
Bases :
BaseRestViewBase class for task rest api
The views contexts are instances of self.factory
Collection Views
POST
Create a new task
Item views
GET
Returns the context in json format
GET?form_config
returns the form configuration
PUT / PATCH
Edit the current element
DELETE
Delete the current element
Form Configuration ?action=form_config url
options
The available options returned to the UI
sections
Description of the different section of the form Keys provided in « sections » must be handled by the JS code.
TODO : Enhance this part to make it more generic.
- after_flush(entry, edit, attributes)¶
Allows to modify datas after the main entry was flushed
HTTP POST and PUT calls
- dbsession: DBSESSION¶
- factory = None¶
- 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 Task add/edition
- Paramètres:
submitted (dict) – The submitted datas
- Renvoie:
A colander.Schema
- pre_format(datas, edit=False)¶
Allows to apply pre-formatting to the submitted datas
HTTP POST and PUT calls
- request: Request¶
- session: ISession¶
- class endi.views.task.rest_api.TaskStatusLogEntryRestView(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¶
- endi.views.task.rest_api.task_total_view(context, request)¶
Return the Task total representation in json
Allow to avoid computing totals js side
endi.views.task.utils module¶
Common utilities used for task edition
- endi.views.task.utils.collect_price_study_product_types()¶
- endi.views.task.utils.get_business_types(request)¶
- endi.views.task.utils.get_default_product_id(request, products, default_tva)¶
Try to find a default product_id regarding the current context
- endi.views.task.utils.get_default_tva(request, tva_options)¶
Return the default tva to be used in this specific context
The last used in the document
or - The default one
- endi.views.task.utils.get_field_definition(fieldname)¶
- endi.views.task.utils.get_mentions(request)¶
Collect Task mentions regarding the context’s business type
- Paramètres:
request (obj) – The current request object with a Task context
- Renvoie:
List of TaskMention in their json repr
- endi.views.task.utils.get_payment_conditions(request)¶
Collect available PaymentConditions
- Paramètres:
request (obj) – The current request object
- Renvoie:
List of PaymentConditions
- endi.views.task.utils.get_products(request)¶
Collect products regarding the context
- Paramètres:
request (obj) – The current request object with a Task context
- Renvoie:
List of Product objects
- endi.views.task.utils.get_task_insurance_options(request)¶
Collect insurance options
- endi.views.task.utils.get_task_parent_url(request, task=None, business='____none')¶
Returns a task parent url regarding its business type
all task doesn’t have a business (estimations without invoices)
on deleting a single invoice with no estimation, the business is deleted too,
during view execution, the task.business could point to a expired object
- endi.views.task.utils.get_task_url(request, task=None, _query={}, suffix='', api=False, _anchor=None, absolute=False)¶
Return the route_name associated to the given Task
- endi.views.task.utils.get_task_view_type(task)¶
Compute the view/acl label for the given task based on its type_
- endi.views.task.utils.get_tvas(request)¶
Collect tva objects regarding the request context
- Paramètres:
request (obj) – The current request object with a Task context
- Renvoie:
List of Tva objects
- endi.views.task.utils.get_workunits(request)¶
Collect available Workunits
- Paramètres:
request (obj) – The current request object
- Renvoie:
List of Workunits
- endi.views.task.utils.task_pdf_link(request, titleTasktype='ce document', task=None)¶
Return the route_name associated to the given Task
- Paramètres:
request – Pyramid request
task – Task instance
endi.views.task.views module¶
Base Task views
- class endi.views.task.views.BaseTaskHtmlTreeMixin¶
Bases :
TreeMixin- children = []¶
- context = None¶
- current()¶
- request = None¶
- 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.task.views.TaskAddView(context, request=None)¶
Bases :
BaseView- get_parent_link()¶
Add buttons in the request actionmenu attribute
- title = '*** Titre à modifier ***'¶
- class endi.views.task.views.TaskDeleteView(context, request=None)¶
Bases :
DeleteViewBase task deletion view
- dbsession: DBSESSION¶
- property delete_msg¶
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”.
- msg = 'Le document {context.name} a bien été supprimé.'¶
- on_before_delete()¶
- on_delete()¶
- redirect()¶
Return a redirect url after task deletion
- request: Request¶
- session: ISession¶
- class endi.views.task.views.TaskDuplicateView(context, request=None)¶
Bases :
BaseFormViewTask duplication view
- before(form)¶
Performs some processing on the
formprior 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.tasks.base.DuplicateSchema object at 140624296223632 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- submit_success(appstruct)¶
- property title¶
- class endi.views.task.views.TaskEditView(context, request=None)¶
Bases :
BaseView,TreeMixin,TaskJsAppViewMixin- catalog_tree_url()¶
- children = []¶
- task_line_group_api_url()¶
- 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.task.views.TaskFilesView(context, request=None)¶
Bases :
ProjectFilesView,BaseTaskHtmlTreeMixin- children = []¶
- dbsession: DBSESSION¶
- get_project_id()¶
- route_name = ''¶
- 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.task.views.TaskGeneralView(context, request=None)¶
Bases :
BaseView,BaseTaskHtmlTreeMixin,TaskJsAppViewMixinBase Class For the General tab of the Task html view
Subclasses should set
A title (str) attribute or property
A file_route_name (str) attribute or property pointing to the
file tab route - A route_name (str) : route presenting the current view
- children = []¶
- class endi.views.task.views.TaskJsAppViewMixin¶
Bases :
JsAppViewMixin- context_url(_query={})¶
- class endi.views.task.views.TaskMoveToPhaseView(context, request=None)¶
Bases :
BaseViewView used to move a document to a specific directory/phase
expects a get arg « phase » containing the destination phase_id
- class endi.views.task.views.TaskPdfDevView(context, request=None)¶
Bases :
BaseViewReturn the html structure used in pdf generation
- class endi.views.task.views.TaskPdfView(context, request=None)¶
Bases :
BaseViewReturn A pdf representation of the current context
- class endi.views.task.views.TaskPreviewView(context, request=None)¶
Bases :
BaseView,BaseTaskHtmlTreeMixin- children = []¶
- route_name = ''¶
- class endi.views.task.views.TaskSetDraftView(context, request=None)¶
Bases :
BaseViewSet the current task status to draft
- class endi.views.task.views.TaskSetMetadatasView(context, request=None)¶
Bases :
BaseFormView- before(form)¶
Performs some processing on the
formprior 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).
- buttons = (<deform.form.Button object>, <deform.form.Button object>)¶
Tuple of buttons or strings to pass to the form instance. Override in your derived class.
- cancel_failure(appstruct)¶
- cancel_success(appstruct)¶
- dbsession: DBSESSION¶
- redirect()¶
- request: Request¶
- schema = <endi.forms.tasks.base.DuplicateSchema object at 140624295264848 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- submit_success(appstruct)¶
Handle successfull modification
- Paramètres:
appstruct (dict) – The appstruct returned after form validation
- Type renvoyé:
HTTPFound
- property title¶
- class endi.views.task.views.TaskSetProductsView(context, request=None)¶
Bases :
BaseFormViewBase view for setting product codes (on invoices and cancelinvoices)
context
invoice or cancelinvoice
- before(form)¶
Performs some processing on the
formprior 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.tasks.invoice.SetProductsSchema object at 140624295265488 (named )>¶
Colander schema instance to be used to create the form instance. Provide your schema in your derived class.
- session: ISession¶
- submit_success(appstruct)¶
- class endi.views.task.views.TaskStatusView(context, request=None)¶
Bases :
StatusViewView handling base status for tasks (estimation/invoice/cancelinvoice)
Status related views should implement
the validate function to ensure data integrity
state_manager_key (str) to where the status is stored on document model
- check_allowed(status)¶
Check that the status change is allowed
- dbsession: DBSESSION¶
- get_parent_url()¶
- post_status_process(status, params)¶
Launch post status process functions
- Paramètres:
State’s callback
- post_valid_process(status, params)¶
Launched after the status is set to valid
- Paramètres:
State’s callback
- pre_status_process(status, params)¶
Launch pre process functions
- pre_valid_process(status, params)¶
Launched before the valid status is set
- Paramètres:
State’s callback
- pre_wait_process(status, params)¶
Launched before the wait status is set
- Paramètres:
State’s callback
- request: Request¶
- session: ISession¶
- validate()¶
- class endi.views.task.views.TaskZipFileView(context, request=None)¶
Bases :
BaseZipFileView- filename()¶
- endi.views.task.views.get_customer_redirect_btn(request, id_)¶
Button for « go back to customer » link
- endi.views.task.views.get_project_redirect_btn(request, id_)¶
Button for « go back to project » link