endi.forms.tasks package¶
Submodules¶
endi.forms.tasks.base module¶
Task form schemas (estimation, invoice …) Note : since deform doesn’t fit our form needs
- (estimation form is complicated and its structure
is mixing many sqla tables)
- validation process:
set all the line in the colander expected schema validate raise error on an adapted way
build an error dict which is mako understandable
- merging process:
get the datas build a factory merge estimation and task object commit merge all lines commit merge payment conditions commit
formulaire :
phase, displayUnits lignes de prestation descr, cout qtité, unité, tva lignes de remise descr, cout, tva (seulement les tvas utilisées dans
les lignes au-dessus)
TOTAL HT for tva in used_tva:
TOTAL TVA tva%
TTC Frais de port TOTAL
- class endi.forms.tasks.base.DuplicateSchema(*args, **kw)¶
Bases :
Schemaschema used to duplicate a task
- class endi.forms.tasks.base.NewTaskSchema(*args, **kw)¶
Bases :
Schemaschema used to initialize a new task
- endi.forms.tasks.base.add_date_field_after_bind(schema, kw)¶
Add a date edition field if the current user has the appropriate rights
- endi.forms.tasks.base.change_metadatas_fields_after_bind(schema, kw)¶
Alter metadatas fields after binding the metadatas modification schema
- endi.forms.tasks.base.get_business_types_from_request(request)¶
Collect available business types allowed for the current user/context
- Paramètres:
request (obj) – The current Pyramid request
- endi.forms.tasks.base.get_duplicate_schema()¶
Return the schema for task duplication
- Renvoie:
The schema
- endi.forms.tasks.base.get_same_year_validator(context)¶
- endi.forms.tasks.base.get_task_from_context(context)¶
Return the current task from the given context
- Paramètres:
context (obj) – Instance of Task/TaskLine/TaskLineGroup
- Renvoie:
The associated Task object
- endi.forms.tasks.base.get_task_metadatas_edit_schema()¶
Return the schema for editing tasks metadatas
- Renvoie:
The schema
- endi.forms.tasks.base.get_task_type_from_factory(factory) str¶
Find the task « type »
- Paramètres:
factory (class) – Child of Task class
- Lève:
Exception – when factory doesn’t match any of the types
- Type renvoyé:
Literal[« estimation », « invoice », « cancelinvoice »]
- endi.forms.tasks.base.get_task_type_label(task: Task) str¶
Build the task type label (for example for permission check)
- endi.forms.tasks.base.has_set_treasury_perm(kw)¶
Return True if the current user has set_treasury perms on the current context :param dict kw: The bind keyword arguments
- endi.forms.tasks.base.remove_childnode(node, child_node_name)¶
Remove a schema childnode
endi.forms.tasks.estimation module¶
- class endi.forms.tasks.estimation.InvoiceAttachSchema(*args, **kw)¶
Bases :
Schema
- endi.forms.tasks.estimation.get_add_edit_paymentline_schema(includes=None, excludes=None)¶
Return add edit schema for PaymentLine edition
- Paramètres:
(incompatible with includes option)
- Type renvoyé:
colanderalchemy.SQLAlchemySchemaNode
- endi.forms.tasks.estimation.get_edit_estimation_schema(isadmin=False, includes=None, excludes=None, **kw) SQLAlchemySchemaNode¶
Return edit schema for Estimation edition
- Paramètres:
(incompatible with includes option)
- endi.forms.tasks.estimation.get_list_schema(is_global=False, excludes=())¶
Return the estimation list schema
- endi.forms.tasks.estimation.validate_estimation(estimation_object: Estimation, request)¶
Globally validate an estimation_object
- Paramètres:
estimation_object (obj) – An instance of Estimation
request (obj) – The pyramid request
- Raises:
colander.Invalid
- try:
validate_estimation(est, self.request)
- except colander.Invalid as err:
error_messages = err.messages
endi.forms.tasks.invoice module¶
form schemas for invoices related views
- class endi.forms.tasks.invoice.EstimationAttachSchema(*args, **kw)¶
Bases :
Schema
- class endi.forms.tasks.invoice.ProductTaskLine(*args, **kw)¶
Bases :
SchemaA single estimation line
- class endi.forms.tasks.invoice.ProductTaskLines(*args, **kw)¶
Bases :
SequenceSchema
- class endi.forms.tasks.invoice.SetProductsSchema(*args, **kw)¶
Bases :
SchemaForm schema used to configure Products
- endi.forms.tasks.invoice.get_add_edit_cancelinvoice_schema(isadmin=False, includes=None, **kw)¶
Return add edit schema for CancelInvoice edition
- endi.forms.tasks.invoice.get_add_edit_invoice_schema(isadmin=False, includes=None, **kw)¶
Return add edit schema for Invoice edition
- endi.forms.tasks.invoice.get_list_schema(is_global=False, excludes=())¶
Return a schema for invoice listing
is_global
If False, customer select is only related to the current context
- endi.forms.tasks.invoice.get_payment_mode_option_list()¶
Return structured option list for payment mode widget
- endi.forms.tasks.invoice.get_pdf_export_schema()¶
- endi.forms.tasks.invoice.get_product_choices(document)¶
Return data structure for product code select widget options
- endi.forms.tasks.invoice.get_year_options(kw)¶
- endi.forms.tasks.invoice.product_match_tva_validator(form, line_value)¶
- endi.forms.tasks.invoice.validate_cancelinvoice(cancelinvoice_object: CancelInvoice, request)¶
Globally validate an cancelinvoice_object
- Paramètres:
cancelinvoice_object (obj) – An instance of CancelInvoice
request (obj) – The pyramid request
- Raises:
colander.Invalid
- try:
validate_cancelinvoice(est, self.request)
- except colander.Invalid as err:
error_messages = err.messages
- endi.forms.tasks.invoice.validate_invoice(invoice_object: Invoice, request)¶
Globally validate an invoice_object
- Paramètres:
invoice_object (obj) – An instance of Invoice
request (obj) – The pyramid request
- Raises:
colander.Invalid
- try:
validate_invoice(est, self.request)
- except colander.Invalid as err:
error_messages = err.messages
endi.forms.tasks.lists module¶
- class endi.forms.tasks.lists.AmountRangeSchema(*args, **kw)¶
Bases :
SchemaUsed to filter on a range of amount
- class endi.forms.tasks.lists.NumberRangeSchema(*args, **kw)¶
Bases :
Schema- validator(form, value)¶
Validate the number range
- class endi.forms.tasks.lists.PeriodSchema(*args, **kw)¶
Bases :
SchemaA form used to select a period
- endi.forms.tasks.lists.existing_invoice_official_number_validator(number, year=None)¶
endi.forms.tasks.payment module¶
form schemas for invoices related views
- class endi.forms.tasks.payment.PaymentSchema(*args, **kw)¶
Bases :
Schemacolander schema for payment recording
- endi.forms.tasks.payment.get_form_grid_from_request(request)¶
- endi.forms.tasks.payment.get_invoice_from_context(request)¶
- endi.forms.tasks.payment.get_payment_schema(with_new_remittance_confirm: bool = False, gen_inverse_payment: bool = False)¶
Returns the schema for payment registration
- Paramètres:
with_new_remittance_confirm – if True, a new remittance confirmation field is added
gen_inverse_payment – if True, some fields are made read-only
- endi.forms.tasks.payment.remove_attrs_on_internal_payment(schema, kw)¶
After schema attributes not used for internal payments
endi.forms.tasks.task module¶
- endi.forms.tasks.task.business_type_filter_node(name='business_type_id', title="Type d'affaire", default='all')¶
« Filter by business type » SchemaNode for listings
- endi.forms.tasks.task.get_add_edit_discountline_schema(includes=None, excludes=None)¶
Return add edit schema for DiscountLine edition
- Paramètres:
includes (tuple) – field that should be included (if None,
excludes will be used instead) :param tuple excludes: Model attributes that should be excluded for schema generation (if None, a default one is provided)
- Type renvoyé:
colanderalchemy.SQLAlchemySchemaNode
- endi.forms.tasks.task.get_add_edit_post_ttc_line_schema(includes=None, excludes=None)¶
Return add edit schema for PostTTCLine edition
- Paramètres:
includes (tuple) – field that should be included (if None,
excludes will be used instead) :param tuple excludes: Model attributes that should be excluded for schema generation (if None, a default one is provided)
- Type renvoyé:
colanderalchemy.SQLAlchemySchemaNode
- endi.forms.tasks.task.get_add_edit_taskline_schema(includes=None, excludes=None)¶
Return add edit schema for TaskLine edition
- Paramètres:
includes (tuple) – field that should be included (if None,
excludes will be used instead) :param tuple excludes: Model attributes that should be excluded for schema generation (if None, a default one is provided)
- Type renvoyé:
colanderalchemy.SQLAlchemySchemaNode
- endi.forms.tasks.task.get_add_edit_tasklinegroup_schema(includes=None, excludes=None)¶
Return add edit schema for TaskLineGroup edition
- Paramètres:
includes (tuple) – field that should be included (if None,
excludes will be used instead) :param tuple excludes: Model attributes that should be excluded for schema generation (if None, a default one is provided)
- Type renvoyé:
colanderalchemy.SQLAlchemySchemaNode
- endi.forms.tasks.task.get_add_task_schema(factory, request, company_id: int, customer_id: Optional[int] = None, project_id: Optional[int] = None, phase_id: Optional[int] = None) SQLAlchemySchemaNode¶
Build the Task add schema
NB : must be called during the request processing in a view’s method, not once as class attribute (once in the WSGI context)
- endi.forms.tasks.task.get_business_types_option_list()¶
Return structured option list for business types widget
- endi.forms.tasks.task.get_edit_task_schema(factory, isadmin=False, includes=None, excludes=None, **kw) SQLAlchemySchemaNode¶
Return a schema for task edition
- Paramètres:
excludes will be used instead) :param tuple excludes: Model attributes that should be excluded for schema generation (if None, a default one is provided) :returns: colanderalchemy.SQLAlchemySchemaNode
- endi.forms.tasks.task.get_new_task_name(factory, project: Optional[Project] = None, business: Optional[Business] = None) str¶
Build a default new task name
- Paramètres:
factory (class) – Estimation / Invoice
project – project in which we add a task
business – business in which we add a task (case of progress invoicing)
- Renvoie:
the name to use for the new task
- endi.forms.tasks.task.tva_product_validator(node, value)¶
Validator checking that tva and product_id matches