endi.models.project package¶
Submodules¶
endi.models.project.business module¶
- class endi.models.project.business.Business(**kwargs)¶
Bases :
BusinessMetricsMixin,NodePermet de :
Collecter les fichiers
Regrouper devis/factures/avoirs
Calculer le CA d’une affaire
Générer les factures
Récupérer le HT à dépenser
Des choses plus complexes en fonction du type de business
Business.estimations Business.invoices Business.invoices[0].cancelinvoices
- CLASSIC_MODE = 'classic'¶
- PROGRESS_MODE = 'progress'¶
- add_estimation(request, user)¶
Generate a new estimation attached to the current business
- Paramètres:
user (obj) – The user generating the estimation
- Type renvoyé:
class endi.models.task.estimation.Estimation
- add_invoice(request, user)¶
Generate a new invoice attached to the current business
- Paramètres:
user (obj) – The user generating the invoice
- Type renvoyé:
class endi.models.task.invoice.Invoice
- add_progress_invoicing_invoice(request, user)¶
Generate a new invoice attached to the current business
- Paramètres:
user (obj) – The user generating the invoice
- Type renvoyé:
class endi.models.task.invoice.Invoice
- amount_to_invoice(column_name='ht')¶
Compute the amount to invoice in this business :param: column_name : ht/ttc :returns: The amount in the *10^5 precision :rtype: int
- base_expense_lines¶
- bpf_datas¶
- business_type¶
- business_type_id¶
- children¶
- closed¶
- created_at¶
- estimations¶
- file_requirement_service¶
alias de
BusinessFileRequirementService
- file_requirements¶
- files¶
- find_deadline(deadline_id)¶
Find the deadline matching this id
- Paramètres:
deadline_id (int) – The deadline id
- Renvoie:
A Payment instance
- find_deadline_from_invoice(invoice)¶
Find the deadline associated to the current business and the given invoice
- Paramètres:
invoice (obj) – The Invoice we’re working on
- Renvoie:
A BusinessPaymentDeadline instance
- fk_filter_field = 'business_id'¶
- gen_invoices(request, user, payment_deadlines=None)¶
Generate invoices for the given list of payment_deadlines (or all if not provided)
- Paramètres:
business (obj) – The Business in which we work
user (obj) – The current connected user
payment_deadlines (list) – Optionnal the deadlines for which we
generate invoices else all deadlines :returns: A list of invoices
- get_company_id()¶
- get_current_invoice()¶
Test if the business has an invoice that is currently edited
- Type renvoyé:
Invoice/CancelInvoice
- get_customer()¶
- get_deposit_deadlines(waiting=True)¶
Collect deposit related deadlines
- Paramètres:
waiting (bool) – Only deadlines not yet invoiced ?
- Renvoie:
A list of deadlines
- get_file_requirements(scoped=False, file_type_id=None)¶
Return the file requirements related to this business :param bool scoped: If True, return only the file requirements that are directly associated with this business
- get_file_requirements_status()¶
Return the status of the indicators concerning this Task
- has_previous_invoice(invoice)¶
Test if the business has a previous invoice (chronologically)
- id¶
- indicators¶
- property invoiced¶
- invoices¶
- invoices_only¶
- invoicing_mode¶
- invoicing_years()¶
List the financial years of related invoices :rtype: list
- is_visible()¶
Check if this business should be shown to the end user (if it’s parent project is not of default type)
- Type renvoyé:
- is_void()¶
Check if the current business is Void :rtype: bool
- name¶
- on_estimation_signed_status_change()¶
Callback launched when estimation signed_status changes
- on_task_delete(request, task)¶
Callback launched when a draft task has been deleted in the business
- Paramètres:
task (obj) – The deleted Task
- parent_id¶
- payment_deadlines¶
- property payment_lines¶
Collect payment lines that are referenced by a deadline
- populate_deadlines(estimation=None)¶
Populate the current business with its associated payment deadlines regarding the estimations belonging to this business
- Paramètres:
estimation (obj) – An optionnal Estimation instance
- Renvoie:
This instance
- populate_indicators() Business¶
Populate Business related indicators
To be run after creation
- Renvoie:
The business we manage
- populate_progress_invoicing_cancelinvoice(request, invoice, cancelinvoice)¶
Populate the Progress Invoicing Plan associated to a cancelinvoice :param obj plan: ProgressInvoicingPlan
- populate_progress_invoicing_plan(plan)¶
Populate the Progress Invoicing Plan associated to an invoice :param obj plan: ProgressInvoicingPlan
- populate_progress_invoicing_status(exclude_estimation=None)¶
Populate the progress invoicing statuses
- Paramètres:
exclude_estimation (obj) – Estimation to be excluded from treatment
- progress_invoicing_chapter_statuses¶
- progress_invoicing_is_complete()¶
Check if this business has been invoiced totally
- Renvoie:
True if it’s completely invoiced
- Type renvoyé:
- progress_invoicing_plans¶
- project¶
- project_id¶
- set_progress_invoicing_mode()¶
Change invoicing_mode to progress and populate
- status¶
- status_service¶
alias de
BusinessStatusService
- statuses¶
- supplier_invoice_lines¶
- tasks¶
- type_¶
- unset_progress_invoicing_mode()¶
Change invoicing_mode to classic and clear progress_invoicing related elements
- updated_at¶
endi.models.project.file_types module¶
File types requirement models
- class endi.models.project.file_types.BusinessTypeFileType(**kwargs)¶
Bases :
BaseRelationship table between
endi.models.project.types.BusinessTypeandendi.models.files.FileTypeDescribe the configured file requirements for a given business type
- BUSINESS_MANDATORY = 'business_mandatory'¶
- MANDATORY = 'mandatory'¶
- OPTIONNAL = 'optionnal'¶
- PROJECT_MANDATORY = 'project_mandatory'¶
- RECOMMENDED = 'recommended'¶
- STATUS_REQUIREMENT_TYPES = ('project_mandatory', 'business_mandatory', 'mandatory', 'recommended')¶
- business_type¶
- business_type_id¶
- doctype¶
- file_type¶
- file_type_id¶
- classmethod get_file_requirements(business_type_id, doctype, mandatory=False)¶
Collect file requirements related to a given business_type
- classmethod get_file_type_options(business_type_id: int, doctype: Optional[str] = None, requirement_type: Optional[str] = None)¶
Collect FileTypes associated to (business_type_id, doctype)
- Type renvoyé:
- requirement_type¶
- validation¶
endi.models.project.mentions module¶
Mentions inclues dans les devis et factures
Configurables par l’administrateur
endi.models.project.mixins module¶
- class endi.models.project.mixins.BusinessLinkedModelMixin¶
Bases :
objectChamps pour les modèles qui sont liés optionellement à un client ou dossier ou affaire (ou inclusif !).
La logique doit être respectée (ex: l’affaire doit appartenir au bon client).
- business = <RelationshipProperty at 0x7fe5a9fad320; no key>¶
- business_id = Column(None, Integer(), ForeignKey('business.id'), table=None)¶
- customer = <RelationshipProperty at 0x7fe5a9fad4d0; no key>¶
- customer_id = Column(None, Integer(), ForeignKey('customer.id'), table=None)¶
- link_to(target)¶
Links instance to a Business-related target object
And update other business-related fields consistently.
- Paramètres:
target – instance of Customer, Business or Project
- property parent_model¶
classmethod(function) -> method
Convert a function to be a class method.
A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:
- class C:
@classmethod def f(cls, arg1, arg2, …):
…
It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.
Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.
- project = <RelationshipProperty at 0x7fe5a9fad7a0; no key>¶
- project_id = Column(None, Integer(), ForeignKey('project.id'), table=None)¶
- class endi.models.project.mixins.BusinessMetricsMixin¶
Bases :
objectGroup methods to compute « business intelligence » metrics/agregates.
- Require from implementors :
a self._endi_service with the methods : - get_total_income() - get_total_estimated()
a fk_filter_field property, a column name that must be present on BusinessLinkedModelMixin implementors
- get_total_expenses(tva_on_margin: Optional[bool] = None)¶
Total linked expenses, cumulating Expense Sheet lines and Supplier Invoice lines
- Paramètres:
tva_on_margin – if None, counts all linked expenses if True, only linked expenses that are in tva_on_margin mode if False, only linked expenses that are not in tva_on_margin mode
- Renvoie:
decimal encoded as integer, precision=2
endi.models.project.naming module¶
- class endi.models.project.naming.LabelOverride(**kwargs)¶
Bases :
BaseAllows to store information about label overriding
E.g: « devis » becoming « bon de livraison » for « construction » business type.
Each instance is a CAE-configuration about a name overriden for a business_type+task type combination.
- SUPPORTED_LABEL_KEYS = ['estimation', 'invoice', 'cancelinvoice']¶
- business_type¶
- business_type_id¶
- id¶
- label_key¶
- label_value¶
endi.models.project.phase module¶
- class endi.models.project.phase.Phase(**kwargs)¶
Bases :
BasePhase d’un dossier
- property cancelinvoices¶
- property estimations¶
- get_tasks_by_type(type_)¶
return the tasks of the passed type
- id¶
- property invoices¶
- is_default()¶
return True if this phase is a default one
- label()¶
Return a label representing this phase
- name¶
- project¶
- project_id¶
- classmethod query_for_select(project_id)¶
Build a sqla query suitable for a select widget
- Paramètres:
project_id (int) – The project the phases are attached to
- tasks¶
endi.models.project.project module¶
Project model
- class endi.models.project.project.Project(**kwargs)¶
Bases :
BusinessMetricsMixin,NodeThe project model
- archived¶
- business_types¶
- businesses¶
- cancelinvoices¶
- classmethod check_phase_id(project_id, phase_id)¶
- children¶
- code¶
- company¶
- company_id¶
- created_at¶
- customers¶
- definition¶
- description¶
- ending_date¶
- estimations¶
- file_requirement_service¶
alias de
ProjectFileRequirementService
- file_requirements¶
- files¶
- fk_filter_field = 'project_id'¶
- get_all_business_types(request)¶
Return all the business types that can used in the given project
- classmethod get_code_list_with_labels(company_id)¶
- get_company_id()¶
- classmethod get_customer_projects(customer_id)¶
- get_file_requirements(scoped=False, file_type_id=None)¶
Return the project file requirements
- get_next_cancelinvoice_index()¶
- get_next_estimation_index()¶
- get_next_invoice_index()¶
- get_used_business_type_ids()¶
- has_internal_customer()¶
- has_tasks()¶
- id¶
- invoices¶
- is_deletable()¶
Return True if this project could be deleted
- classmethod label_query()¶
- mode¶
- name¶
- parent_id¶
- phases¶
- project_type¶
- project_type_id¶
- classmethod query_for_select(company_id)¶
Build a sqla query suitable for a select widget
- Paramètres:
company_id (int) – The company the projects are attached to
- starting_date¶
- statuses¶
- tasks¶
- type_¶
- updated_at¶
endi.models.project.types module¶
Project Type management
- class endi.models.project.types.BaseProjectType(**kwargs)¶
Bases :
Base- active¶
- allowed(request)¶
Check if the current request allows to access this Type
- Paramètres:
request (obj) – The Pyramid request object
- Type renvoyé:
- editable¶
- id¶
- name¶
- private¶
- classmethod query_for_select()¶
Query project types for selection purpose
- type_¶
- class endi.models.project.types.BusinessType(**kwargs)¶
Bases :
BaseProjectType- active¶
- editable¶
- file_template_rel¶
- file_type_rel¶
- classmethod get_by_name(name)¶
- classmethod get_default()¶
- classmethod get_mandatory_mentions(btype_id, doctype)¶
- id¶
- is_used()¶
Check if there is a project using this specific type
- label¶
- label_overrides¶
- mandatory_mentions(doctype)¶
- name¶
- optionnal_mentions(doctype)¶
- other_project_types¶
- private¶
- project_type¶
- project_type_id¶
- task_mention_rel¶
- tva_on_margin¶
- type_¶
- class endi.models.project.types.ProjectType(**kwargs)¶
Bases :
BaseProjectType- active¶
- default¶
- default_business_type¶
- editable¶
- get_business_type_ids()¶
Collect business type ids that can be associated to this project type
- classmethod get_by_name(name)¶
- classmethod get_default()¶
- get_default_business_type()¶
Return the default business type of the project, event if not active
- get_other_business_type_ids()¶
- ht_compute_mode_allowed¶
- id¶
- include_price_study¶
- is_tva_on_margin()¶
Returns if the project type must be considered as « TVA on margin » or not
- is_used()¶
Check if there is a project using this specific type
- label¶
- name¶
- other_business_types¶
- price_study_default()¶
- price_study_mandatory()¶
- price_study_mode¶
- price_study_optionnal()¶
- private¶
- classmethod query_for_select()¶
Query project types for selection purpose
- ttc_compute_mode_allowed¶
- type_¶
- with_business¶