endi.models.sale_product package¶
Submodules¶
endi.models.sale_product.base module¶
- class endi.models.sale_product.base.BaseSaleProduct(**kwargs)¶
Bases :
Base,TimeStampedMixinid
Ventes
label description ht unity tva
Achats
supplier_id -> supplier supplier_ref supplier_unity_amount supplier_ht
Informations Internes
category_id product_type = Material / WorkForce / Product / Article ref
Notes
- ALL_TYPES = ('sale_product_product', 'sale_product_material', 'sale_product_work_force', 'sale_product_service_delivery', 'sale_product_work', 'sale_product_training')¶
- SIMPLE_TYPES = ('sale_product_product', 'sale_product_material', 'sale_product_work_force', 'sale_product_service_delivery')¶
- TYPE_LABELS = ('Produit', 'Matériau', 'Main d’œuvre', 'Prestation de service', 'Produit composé (Chapitre ou Ouvrage)', 'Produit composé (Formation)')¶
- archived¶
- category¶
- category_id¶
- company¶
- company_id¶
- created_at¶
- description¶
- duplicate(dest_class: Optional[BaseSaleProduct] = None)¶
- classmethod find_last_used_mode(company_id: int) str¶
Retrieve the last mode (ht/ttc/supplier_ht) used by this company in its sale product catalog
- get_current_stock()¶
- ht¶
- id¶
- is_locked()¶
- label¶
- margin_rate¶
- mode¶
- notes¶
- on_before_commit(state, changes=None)¶
- product¶
- product_id¶
- purchase_type¶
- purchase_type_id¶
- classmethod query()¶
return a query
- ref¶
- stock_operations¶
- supplier¶
- supplier_ht¶
- supplier_id¶
- supplier_ref¶
- supplier_unity_amount¶
- sync_amounts()¶
- ttc¶
- tva¶
- tva_id¶
- type_¶
- unity¶
- updated_at¶
- work_items¶
endi.models.sale_product.category module¶
- class endi.models.sale_product.category.SaleProductCategory(**kwargs)¶
Bases :
BaseA product category allowing to group products
- company¶
- company_id¶
- description¶
- classmethod get_by_title(title: str, company: Company, case_sensitive: bool = True) Optional[SaleProductCategory]¶
Exact match will always be preferred.
- id¶
- title¶
endi.models.sale_product.sale_product module¶
Models related to simple product management
SaleProductProduct
SaleProductMaterial
SaleProductWorkForce
SaleProductServiceDelivery
SaleProductStockOperation
- class endi.models.sale_product.sale_product.SaleProductMaterial(**kwargs)¶
Bases :
BaseSaleProduct- archived¶
- category¶
- category_id¶
- company¶
- company_id¶
- created_at¶
- description¶
- ht¶
- id¶
- label¶
- margin_rate¶
- mode¶
- notes¶
- product¶
- product_id¶
- purchase_type¶
- purchase_type_id¶
- ref¶
- stock_operations¶
- supplier¶
- supplier_ht¶
- supplier_id¶
- supplier_ref¶
- supplier_unity_amount¶
- ttc¶
- tva¶
- tva_id¶
- type_¶
- unity¶
- updated_at¶
- work_items¶
- class endi.models.sale_product.sale_product.SaleProductProduct(**kwargs)¶
Bases :
BaseSaleProduct- archived¶
- category¶
- category_id¶
- company¶
- company_id¶
- created_at¶
- description¶
- ht¶
- id¶
- label¶
- margin_rate¶
- mode¶
- notes¶
- product¶
- product_id¶
- purchase_type¶
- purchase_type_id¶
- ref¶
- stock_operations¶
- supplier¶
- supplier_ht¶
- supplier_id¶
- supplier_ref¶
- supplier_unity_amount¶
- ttc¶
- tva¶
- tva_id¶
- type_¶
- unity¶
- updated_at¶
- work_items¶
- class endi.models.sale_product.sale_product.SaleProductServiceDelivery(**kwargs)¶
Bases :
BaseSaleProductPrestation
- archived¶
- category¶
- category_id¶
- company¶
- company_id¶
- created_at¶
- description¶
- ht¶
- id¶
- label¶
- margin_rate¶
- mode¶
- notes¶
- product¶
- product_id¶
- purchase_type¶
- purchase_type_id¶
- ref¶
- stock_operations¶
- supplier¶
- supplier_ht¶
- supplier_id¶
- supplier_ref¶
- supplier_unity_amount¶
- ttc¶
- tva¶
- tva_id¶
- type_¶
- unity¶
- updated_at¶
- work_items¶
- class endi.models.sale_product.sale_product.SaleProductWorkForce(**kwargs)¶
Bases :
BaseSaleProductMain d’oeuvre
- archived¶
- category¶
- category_id¶
- company¶
- company_id¶
- created_at¶
- description¶
- ht¶
- id¶
- label¶
- margin_rate¶
- mode¶
- notes¶
- product¶
- product_id¶
- purchase_type¶
- purchase_type_id¶
- ref¶
- stock_operations¶
- supplier¶
- supplier_ht¶
- supplier_id¶
- supplier_ref¶
- supplier_unity_amount¶
- ttc¶
- tva¶
- tva_id¶
- type_¶
- unity¶
- updated_at¶
- work_items¶
endi.models.sale_product.services module¶
- class endi.models.sale_product.services.SaleProductService¶
Bases :
object- classmethod get_ht(sale_product)¶
- classmethod get_ttc(sale_product)¶
- classmethod is_locked(sale_product)¶
- classmethod on_before_commit(sale_product, state, changes=None)¶
Launched when the product has been added/modified/deleted
- classmethod sync_amounts(sale_product)¶
- class endi.models.sale_product.services.SaleProductWorkService¶
Bases :
SaleProductService- classmethod cost_price(sale_product)¶
Compute the cost price of the given sale_product work suming the cost of its differect items
Prix de revient = Déboursé sec * ( 1 + Coefficient frais généraux )
- classmethod flat_cost(sale_product)¶
Compute the flat cost of a complex sale_product
1/ Déboursé sec = Total matériaux + Total main d’oeuvre + Total matériel affecté
- classmethod get_ht(sale_product, contribution=None)¶
Compute the unit HT amount for this sale_product
- classmethod get_ttc(sale_product)¶
Compute the TTC amount for the given sale_product
- classmethod intermediate_price(sale_product)¶
Compute the intermediate price
3/ Prix intermédiaire = Prix de revient / ( 1 - ( Coefficients marge + aléas + risques ) )
- classmethod on_before_commit(work, state, changes=None)¶
On before commit we update the ht amount
- classmethod sync_amounts(work, work_only=False)¶
- Paramètres:
work_only – Only sync work’s amounts else also items”
- class endi.models.sale_product.services.WorkItemService¶
Bases :
object- classmethod compute_total_ht(work_item)¶
Compute the total ht for the given work_item
- classmethod cost_price(work_item, unitary=False)¶
Compute the cost price of the given sale_product work item Uses the company’s general overhead
- classmethod flat_cost(work_item, unitary=False)¶
Collect the flat cost for this 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 ) )
- Paramètres:
unitary (bool) – Unitary cost ?
- classmethod on_before_commit(work_item, state, changes=None)¶
Launched when the product has been flushed yet
- 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 current work item amounts
- Paramètres:
work_item (obj) – The current work_item
work (obj) – Optionnal work which called this sync_amounts func
- classmethod total_ttc(work_item, tva=None)¶
Compute the total ttc for this Work item using the TVA passed in argument
- Paramètres:
tva (obj) – Tva instance
- classmethod unit_ht(work_item)¶
Compute the ht value for the given work item
endi.models.sale_product.training module¶
- class endi.models.sale_product.training.SaleProductTraining(**kwargs)¶
Bases :
SaleProductWorkA Training related model :param id: unique id :param goals: goals of title of the training item :param prerequisites: prerequisites to subscribe to the training session :param for_who: target of the training item :param duration: duration of the training item :param content: content of the training item :param teaching_method: teaching_method used in training session :param logistics_means: logistics_means implemented for the training session :param more_stuff: Les plus… :param evaluation: evaluation criteria :param place: place if the training session :param modality: modality of the training session :param types: types of the training :param date: date og the training session :param price: price of the training session :param free_1: free input :param free_2: free input :param free_3: free input :param company_id: company that owns the training :param company_id: company that owns the group
- archived¶
- category¶
- category_id¶
- company¶
- company_id¶
- content¶
- created_at¶
- date¶
- description¶
- duplicate()¶
- duration¶
- evaluation¶
- for_who¶
- free_1¶
- free_2¶
- free_3¶
- goals¶
- ht¶
- id¶
- items¶
- label¶
- logistics_means¶
- margin_rate¶
- modality_one¶
- modality_two¶
- mode¶
- more_stuff¶
- notes¶
- place¶
- prerequisites¶
- price¶
- product¶
- product_id¶
- purchase_type¶
- purchase_type_id¶
- ref¶
- stock_operations¶
- supplier¶
- supplier_ht¶
- supplier_id¶
- supplier_ref¶
- supplier_unity_amount¶
- teaching_method¶
- title¶
- ttc¶
- tva¶
- tva_id¶
- type_¶
- types¶
- unity¶
- updated_at¶
- work_items¶
endi.models.sale_product.work module¶
- class endi.models.sale_product.work.SaleProductWork(**kwargs)¶
Bases :
BaseSaleProductWork entity grouping several products
- archived¶
- category¶
- category_id¶
- company¶
- company_id¶
- cost_price()¶
- created_at¶
- description¶
- duplicate(dest_class=None)¶
- flat_cost()¶
Renvoie le coût unitaire utilisé comme base pour les calculs
- ht¶
- id¶
- intermediate_price()¶
- items¶
- label¶
- margin_rate¶
- mode¶
- notes¶
- product¶
- product_id¶
- purchase_type¶
- purchase_type_id¶
- ref¶
- stock_operations¶
- supplier¶
- supplier_ht¶
- supplier_id¶
- supplier_ref¶
- supplier_unity_amount¶
- sync_amounts(work_only=False)¶
- title¶
- ttc¶
- tva¶
- tva_id¶
- type_¶
- unity¶
- updated_at¶
- work_items¶
endi.models.sale_product.work_item module¶
Models related to work item management
WorkItem
- class endi.models.sale_product.work_item.WorkItem(**kwargs)¶
Bases :
Baseid
Ventes
type_ ht (product ht) total_ht (ht * quantity) unity quantity base_sale_product_id (relationship) work_id (relationshio) product_id (relationship) tva_id (relationship) description
- SALE_PRODUCT_FACTORIES = {'sale_product_material': <class 'endi.models.sale_product.sale_product.SaleProductMaterial'>, 'sale_product_product': <class 'endi.models.sale_product.sale_product.SaleProductProduct'>, 'sale_product_service_delivery': <class 'endi.models.sale_product.sale_product.SaleProductServiceDelivery'>, 'sale_product_work_force': <class 'endi.models.sale_product.sale_product.SaleProductWorkForce'>}¶
- base_sale_product¶
- base_sale_product_id¶
- compute_total_ht()¶
- cost_price(unitary=False)¶
- description¶
- duplicate()¶
- flat_cost(unitary=False)¶
- classmethod from_base_sale_product(sale_product)¶
Create a new instance generated from the given sale_product
- generate_sale_product(label, category_id, company, **attributes)¶
Generate a sale product from a work item object
- Paramètres:
label (str) – The label configured by the user when creating the
workitem :param category_id: the category :param company_id: the company we’re working on :param dict attributes: The submitted datas (are not all set at this stage) :return: BasSaleProduct Object
- get_company()¶
- get_tva()¶
- ht¶
- id¶
- intermediate_price(unitary=False)¶
- locked¶
- mode¶
- on_before_commit(state, changes=None)¶
- price_with_contribution(unitary=False, base_sale_price=None)¶
- price_with_insurance(unitary=False, base_sale_price=None)¶
- quantity¶
- sale_product_work¶
- sale_product_work_id¶
- supplier_ht¶
- sync_amounts(work=None)¶
- sync_base_sale_product()¶
Synchronize associated base_sale_product with the current work items info
- Renvoie:
BasSaleProduct Object
- total_ht¶
- total_ttc(tva=None)¶
- type_¶
- unit_ht()¶
- unity¶