endi.models.price_study package¶
Submodules¶
endi.models.price_study.base module¶
- class endi.models.price_study.base.BasePriceStudyProduct(**kwargs)¶
Bases :
Base,TimeStampedMixinBase class for PriceStudyProducts and PriceStudyWorks
- TYPE_LABELS = {'price_study_product': 'Produit simple', 'price_study_work': 'Ouvrage'}¶
- chapter¶
- chapter_id¶
- compute_total_ht()¶
- cost_price()¶
- created_at¶
- description¶
- duplicate(from_parent=False, force_ht=False)¶
- Paramètres:
from_parent (bool) – We are duplicating the whole tree, the parent is not
the same as the current’s instance :param bool force_ht: Should we force ht mode while duplicating ?
- flat_cost()¶
- classmethod from_sale_product(sale_product)¶
- get_company()¶
- get_company_id()¶
- get_general_overhead()¶
- get_task()¶
- ht¶
- ht_by_tva()¶
- id¶
- intermediate_price()¶
- margin_rate¶
- on_before_commit(request, state, attributes=None)¶
- order¶
- price_study¶
- price_with_contribution(base_price=None)¶
- price_with_insurance(base_price=None)¶
- product¶
- product_id¶
- quantity¶
- sync_amounts(propagate=True)¶
Set cached amounts on the current object
- Paramètres:
propagate (bool) – Should we propagate the syncing up (else we sync down in
case of PriceStudyWork entries) ?
- sync_with_task(request)¶
- task_line¶
- task_line_id¶
- total_ht¶
- ttc()¶
- tva¶
- tva_id¶
- type_¶
- unit_ht()¶
- unity¶
- updated_at¶
endi.models.price_study.chapter module¶
- class endi.models.price_study.chapter.PriceStudyChapter(**kwargs)¶
Bases :
BaseChapitre : Correspond au TaskLineGroup du document associé
- description¶
- duplicate(from_parent=False, force_ht=False)¶
- get_company()¶
- get_company_id()¶
- get_general_overhead()¶
- get_task()¶
- id¶
- on_before_commit(request, action, changes=None)¶
- order¶
- price_study¶
- price_study_id¶
- products¶
- sync_with_task(request, task)¶
- task_line_group¶
- task_line_group_id¶
- title¶
- total_ht(request)¶
Total HT without discounts
endi.models.price_study.discount module¶
- class endi.models.price_study.discount.PriceStudyDiscount(**kwargs)¶
Bases :
BaseA discount line
- amount¶
- description¶
- duplicate(from_parent=False)¶
return the equivalent InvoiceLine
- get_company_id()¶
- get_task()¶
- ht_by_tva()¶
- id¶
- property is_percentage¶
- on_before_commit(request, state, attributes=None)¶
- order¶
- percentage¶
- price_study¶
- price_study_id¶
- sync_with_task(request, price_study=None)¶
- total_ht()¶
- total_ttc()¶
- total_tva()¶
- tva¶
- tva_id¶
- type_¶
endi.models.price_study.price_study module¶
- class endi.models.price_study.price_study.PriceStudy(**kwargs)¶
Bases :
TimeStampedMixin,Base- amounts_by_tva()¶
- chapters¶
- created_at¶
- discount_ht()¶
- discount_tva()¶
- discounts¶
- discounts_by_tva()¶
- duplicate(force_ht=False)¶
- force_ht¶
- general_overhead¶
- get_company()¶
- get_company_id()¶
- get_task()¶
- ht¶
- id¶
- is_admin_editable()¶
Check if this price study can be edited by an admin :returns: True/False
- is_editable()¶
Check if this price study can be edited :returns: True/False
- json_totals(request)¶
- mask_hours¶
- on_before_commit(request, action, changes=None)¶
- products¶
- sync_amounts(sync_down=False)¶
Set cached amounts on the current PriceStudy
- Paramètres:
sync_down (bool) – Should we sync_amounts all the products down in the hierarchy ?
- sync_with_task(request)¶
Synchronize the associated task with the price_study configuration (create TaskLineGroup, DiscountLine, TaskLine instances …)
- task¶
- task_id¶
- total_ht()¶
- total_ht_before_discount()¶
- total_ttc()¶
- total_tva()¶
- total_tva_before_discount()¶
- updated_at¶
endi.models.price_study.product module¶
Models related to price study product management
PriceStudyProduct
- class endi.models.price_study.product.PriceStudyProduct(**kwargs)¶
Bases :
BasePriceStudyProductprice study product
- base_sale_product¶
- base_sale_product_id¶
- chapter¶
- chapter_id¶
- created_at¶
- description¶
- duplicate(from_parent=False, force_ht=False)¶
- Paramètres:
from_parent (bool) – We are duplicating the whole tree, the parent is not
the same as the current’s instance :param bool force_ht: Should we force ht mode while duplicating ?
- classmethod from_sale_product(sale_product)¶
- ht¶
- id¶
- margin_rate¶
- mode¶
- order¶
- price_study¶
- product¶
- product_id¶
- quantity¶
- supplier_ht¶
- task_line¶
- task_line_id¶
- total_ht¶
- tva¶
- tva_id¶
- type_¶
- unity¶
- updated_at¶
endi.models.price_study.services module¶
- class endi.models.price_study.services.BasePriceStudyProductService¶
Bases :
object- classmethod get_company(instance)¶
- classmethod get_company_id(instance)¶
- classmethod on_before_commit(request, product, state, changes=None)¶
- classmethod sync_amounts(product, propagate=True)¶
- class endi.models.price_study.services.PriceStudyChapterService¶
Bases :
object- classmethod get_company(chapter)¶
- classmethod get_company_id(chapter)¶
- classmethod on_before_commit(request, chapter, state, changes=None)¶
- classmethod sync_with_task(request, chapter, task, sync_products=True)¶
- classmethod total_ht(request, chapter)¶
Sum the total ht of the products
- class endi.models.price_study.services.PriceStudyDiscountService¶
Bases :
object- classmethod get_company_id(instance)¶
- classmethod ht_by_tva(discount)¶
- classmethod on_before_commit(request, discount, state, attributes)¶
- classmethod sync_with_task(request, instance, price_study)¶
- classmethod total_ht(discount)¶
- classmethod total_ttc(discount)¶
- classmethod total_tva(discount)¶
- class endi.models.price_study.services.PriceStudyProductService¶
Bases :
BasePriceStudyProductService- classmethod compute_total_ht(product)¶
Compute total_ht value for this element
- classmethod cost_price(product)¶
Compute the cost price of the given product work suming the cost of its differect items
- Renvoie:
The result in 10*5 format
- Type renvoyé:
- classmethod flat_cost(product)¶
- classmethod ht_by_tva(product)¶
Return the ht value stored by vta value
- classmethod intermediate_price(product)¶
Compute the intermediate price of a work item
3/ Prix intermédiaire = Prix de revient / ( 1 - ( Coefficients marge + aléas + risques ) )
- classmethod on_before_commit(request, product, state, changes=None)¶
Fires actions before commit
- classmethod price_with_contribution(product, base_price=None)¶
- classmethod price_with_insurance(product, base_price=None)¶
- classmethod sync_amounts(product, propagate=True)¶
Setup amounts for the given product and fire the information up
- classmethod ttc(product)¶
- classmethod unit_ht(product)¶
Compute the ht value for the given work item
- class endi.models.price_study.services.PriceStudyService¶
Bases :
object- classmethod amounts_by_tva(price_study)¶
Collect HT and TVA amounts stored by tva value (in integer format)
e.g : {tva_id: {“ht”: 1000, “tva”: 200}}
- classmethod discount_ht(price_study)¶
- classmethod discount_tva(price_study)¶
- classmethod discounts_by_tva(price_study)¶
- classmethod get_company(study)¶
- classmethod get_company_id(study)¶
- classmethod is_admin_editable(study)¶
Check if the current PriceStudy is editable by an admin
- classmethod is_editable(study)¶
Check if the current PriceStudy is editable
- classmethod on_before_commit(request, price_study, state, changes=None)¶
- classmethod sync_amounts(price_study, sync_down=False)¶
Compute cached amount attributes :param bool sync_down: Should we sync all children in the hierarchy
- classmethod sync_with_task(request, price_study)¶
Sync price_study elements with the associated Task
- classmethod total_ht(price_study)¶
- classmethod total_ht_before_discount(price_study)¶
- classmethod total_ttc(price_study)¶
- classmethod total_tva(price_study)¶
- classmethod total_tva_before_discount(price_study)¶
- class endi.models.price_study.services.PriceStudyWorkItemService¶
Bases :
object- classmethod compute_total_ht(work_item)¶
Compute the total ht for the given work_item
- classmethod compute_total_tva(work_item)¶
- classmethod compute_work_unit_ht(work_item)¶
Compute the ht value per work unit for the given work item
- classmethod cost_price(work_item, unitary=False)¶
Compute the cost price of the given price study work suming the cost of its different items
- Renvoie:
The result in 10*5 format
- Type renvoyé:
- classmethod flat_cost(work_item, unitary=False, work_level=False)¶
- classmethod get_company(work_item)¶
- classmethod get_company_id(work_item)¶
- classmethod get_tva(work_item)¶
- classmethod intermediate_price(work_item, unitary=False)¶
Compute the intermediate price of a work item
3/ Prix intermédiaire = Prix de revient / ( 1 - ( Coefficients marge + aléas + risques ) )
- classmethod on_before_commit(request, work_item, state, changes=None)¶
- Paramètres:
state (str) – “add”/”update”/”delete”
- classmethod price_with_contribution(work_item, unitary=False, base_price=None)¶
- classmethod price_with_insurance(work_item, unitary=False, base_price=None)¶
- classmethod sync_amounts(work_item, work=None)¶
Sync the work_item’s cached values
- Paramètres:
work (obj) – The PriceStudyWork to be synced in case of ascending syncing
- classmethod sync_quantities(work_item, work=None)¶
- classmethod ttc(work_item)¶
Calcul du ttc indicatif pour ce work_item
NB : les arrondis se faisant sur les totaux au niveau du devis/facture, cette valeur peut être imprécise
- classmethod unit_ht(work_item)¶
Compute the ht value for the given work item
- class endi.models.price_study.services.PriceStudyWorkService¶
Bases :
BasePriceStudyProductService- classmethod compute_total_ht(work)¶
- classmethod cost_price(work)¶
Compute the cost price of the given work work suming the cost of its differect items
Prix de revient = Déboursé sec * ( 1 + Coefficient frais généraux )
- classmethod flat_cost(work)¶
Compute the flat cost of a complex work
1/ Déboursé sec = Total matériaux + Total main d’oeuvre + Total matériel affecté
- classmethod ht_by_tva(work)¶
Return the ht value stored by vta value
- classmethod intermediate_price(work)¶
Compute the intermediate price
If globally specified, uses the work’s margin rate for the computation 3/ Prix intermédiaire = Prix de revient / ( 1 - ( Coefficients marge + aléas + risques ) )
- classmethod on_before_commit(request, work, state, changes=None)¶
- classmethod price_with_contribution(work, base_price=None)¶
- classmethod price_with_insurance(work, base_price=None)¶
- classmethod sync_amounts(work, propagate=True)¶
Set all amounts on this work entry
- Paramètres:
propagate (bool) – Should we propagate the syncing up ?
- classmethod sync_quantities(work)¶
Sync all work items quantities and update amounts
- classmethod ttc(work)¶
- classmethod unit_ht(work)¶
endi.models.price_study.work module¶
Models related to price study work management
PriceStudyWork
- class endi.models.price_study.work.PriceStudyWork(**kwargs)¶
Bases :
BasePriceStudyProductprice study entity grouping several price study work items
Can be of two types
Freely added Linked to an existing SaleProductWork
- chapter¶
- chapter_id¶
- created_at¶
- description¶
- display_details¶
- duplicate(from_parent=False, force_ht=False)¶
- Paramètres:
from_parent (bool) – We are duplicating the whole tree, the parent is not
the same as the current’s instance :param bool force_ht: Should we force ht mode while duplicating ?
- classmethod from_sale_product(sale_product)¶
- ht¶
- id¶
- items¶
- margin_rate¶
- order¶
- price_study¶
- product¶
- product_id¶
- quantity¶
- sync_quantities()¶
- task_line¶
- task_line_id¶
- title¶
- total_ht¶
- tva¶
- tva_id¶
- type_¶
- unity¶
- updated_at¶
endi.models.price_study.work_item module¶
Models related to price study work item management
PriceStudyWorkItem
- class endi.models.price_study.work_item.PriceStudyWorkItem(**kwargs)¶
Bases :
BaseWork item
Can be locked to the PriceStudyWork for quantity definition
original associated catalog item
- base_sale_product¶
- base_sale_product_id¶
- cost_price(unitary=False) int¶
Coût d’achat + frais généraux
- Paramètres:
unitary (bool) – Cost by Work unit ?
- description¶
- duplicate(from_parent=False, force_ht=False)¶
Duplicate an element
- Paramètres:
from_parent (bool) – We are duplicating the whole tree, the parent is not
the same as the current’s instance :param bool force_ht: Should we force ht mode while duplicating ?
- flat_cost(unitary=False, work_level=False) int¶
Flat cost : Cost price without any computation
- Paramètres:
unitary (bool) – Cost by Work unit ?
- classmethod from_sale_product(catalog_sale_product)¶
Load a price study work item from a catalog product
- classmethod from_work_item(price_study_work, catalog_work_item)¶
Load a price study work item from a catalog one
- get_company()¶
- Renvoie:
the Company object associated to this WorkItem
- get_general_overhead() float¶
Collect the general overhead that should be used to compute the Salt Ht based on the cost price
- get_margin_rate() float¶
Collect the margin rate that should be used to compute the Salt Ht based on the cost price
- get_price_study()¶
- get_task()¶
Collect the Task instance associated to this WorkItem
- Type renvoyé:
class::endi.models.task.Task
- get_tva()¶
Return the Tva object associated to this WorkItem
- Type renvoyé:
class::endi.models.tva.Tva
- ht¶
- id¶
- intermediate_price(unitary=False) int¶
Coût d’achat + frais généraux + marge
- Paramètres:
unitary (bool) – Cost by Work unit ?
- mode¶
- order¶
- price_study_work¶
- price_study_work_id¶
- price_with_contribution(unitary=False, base_price=None) int¶
Prix avec contribution (si elle est utilisée dans les calculs)
- Paramètres:
unitary (bool) – Cost by Work unit ?
- price_with_insurance(unitary=False, base_price=None) int¶
Prix avec assurance (si elle est utilisée dans les calculs)
- Paramètres:
unitary (bool) – Cost by Work unit ?
- quantity_inherited¶
- supplier_ht¶
- sync_amounts(work=None)¶
Sync the computed amounts on the object (and sync the parents)
- Paramètres:
work (obj) – The parent price_study_work
- sync_quantities(work=None)¶
Sync the work_quantities in the current item
- Paramètres:
work (obj) – The parent price_study_work
- total_ht¶
- total_quantity¶
- unity¶
- work_unit_ht¶
- work_unit_quantity¶