endi.models.progress_invoicing package

Subpackages

Submodules

endi.models.progress_invoicing.invoicing module

Progress invoicing Invoicing models

Models bound to an invoice that stores the data related to progressing invoice Final Invoice are kept in sync with the model here under

Main schema

Invoice <-> ProgressInvoicingPlan

TaskLineGroup <-> ProgressInvoicingChapter

TaskLine <-> ProgressInvoicingProduct
ProgressInvoicingWork

ProgressInvoicingWorkItem

class endi.models.progress_invoicing.invoicing.ProgressInvoicingBaseProduct(**kwargs)

Bases : Base, TimeStampedMixin

already_invoiced
base_status_id
chapter
chapter_id
created_at
gen_cancelinvoice_product()
get_percent_left()
id
on_before_commit(request, state='update', attributes=None)

Méthode lancée avant de commiter la transaction qui modifie l’élément courant

order
percentage
property plan
status
sync_with_task(task_line_group=None)

Generates the TaskLine/TaskLineGroup based on the current ProgressInvoicingPlan

property task
task_line
task_line_id
total_ht() int

Copute the total_ht corresponding to the current percentages

type_
updated_at
class endi.models.progress_invoicing.invoicing.ProgressInvoicingChapter(**kwargs)

Bases : Base, TimeStampedMixin

created_at
gen_cancelinvoice_chapter(cinv_plan)
id
order
plan
plan_id
products
status
status_id
sync_with_task(task=None)

Generates the TaskLine/TaskLineGroup based on the current ProgressInvoicingPlan

property task
task_line_group
task_line_group_id
updated_at
class endi.models.progress_invoicing.invoicing.ProgressInvoicingPlan(**kwargs)

Bases : Base

Associated to an invoice

business
business_id
chapters
gen_cancelinvoice_plan(cancelinvoice)
has_deposit()
id
sync_with_task(task=None)

Generates the TaskLine/TaskLineGroup based on the current ProgressInvoicingPlan

task
task_id
class endi.models.progress_invoicing.invoicing.ProgressInvoicingProduct(**kwargs)

Bases : ProgressInvoicingBaseProduct

already_invoiced
base_status_id
chapter
chapter_id
created_at
id
order
percentage
status
task_line
task_line_id
type_
updated_at
class endi.models.progress_invoicing.invoicing.ProgressInvoicingWork(**kwargs)

Bases : ProgressInvoicingBaseProduct

already_invoiced
base_status_id
chapter
chapter_id
created_at
gen_cancelinvoice_product()
get_percent_left()
id
items
locked
order
percentage
status
task_line
task_line_id
type_
unlock()
updated_at
class endi.models.progress_invoicing.invoicing.ProgressInvoicingWorkItem(**kwargs)

Bases : Base, TimeStampedMixin

already_invoiced
base_status_id
created_at
gen_cancelinvoice_work_item()
get_percent_left()
id
on_before_commit(request, state='update', attributes=None)

Méthode lancée avant de commiter la transaction qui modifie l’élément courant

order
percentage
property plan
status
property task
total_ht() int

Copute the total_ht corresponding to the current percentages

total_ttc(ht=None) int

Compute the total ttc

Paramètres:

ht (int) – HT already computed (to avoid too much compute)

total_tva(ht=None) int

Compute the amount of Tva

Paramètres:

ht (int) – HT already computed (to avoid too much compute)

updated_at
work
work_id

endi.models.progress_invoicing.status module

Progress Invoicing Status models

In a business this models are used

  • To store the percentages that should be invoiced

  • To link invoicing elements with the original estimation’s (or price_study in case

    of WorkItems) elements

    PriceStudy <-> Estimation <-> Business

    PriceStudyChapter <-> TaskLineGroup <-> ProgressInvoicingChapterStatus

    PriceStudyProduct <-> TaskLine <-> ProgressInvoicingProductStatus PriceStudyWork ProgressInvoicingWorkStatus

    PriceStudyWorkItem <———-> ProgressInvoicingWorkItem

class endi.models.progress_invoicing.status.ProgressInvoicingBaseProductStatus(**kwargs)

Bases : Base

Base Progress Invoicing Status used to remember which percentage of which element has been invoiced yet

Linked to a Chapter status

Uses two reference percentage

percent_left

starts at 100% and correspond to the progress invoicing (discussed with the customer)

percent_to_invoice

100% - account_percent and correspond to the percentage to be considered in the progress invoicing

chapter_status
chapter_status_id
get_cost(ui_percentage, product, percent_left)

Compute the cost corresponding to ui_percentage for the given product

Paramètres:
  • ui_percentage (float) – The Percentage to compute

  • product (obj) – The ProgressInvoicingProduct asking for its cost

  • percent_left (float) – The percentage left before this product is invoiced

classmethod get_or_create(source_task_line, chapter_status, percent_to_invoice)

Retrieve or create a new status entry for the given source item

get_percent_left()

Compute the percent left regarding the current status (also when an invoice is currently edited)

Type renvoyé:

float or None

has_deposit()

Return True if a deposit has been deduced from the original HT amount

id
invoiced_elements
invoiced_ht(product=None)

Compute the total ht that was already invoiced Before product if provided

Paramètres:

product (obj) – ProgressInvoicingProduct

invoiced_percentage(product=None)

Compute the percentage that was already invoiced Before product if provided

Paramètres:

product (obj) – ProgressInvoicingProduct

is_completely_invoiced()
percent_left
percent_to_invoice
source_task_line
source_task_line_id
sync_with_plan(progress_invoicing_chapter)

Sync the current product status with the given plan

Generates the ProgressInvoicingProduct

total_deposit()
total_ht_left()

Compute the total ht regarding the current status (also when an invoice is currently edited)

Type renvoyé:

int

total_ht_to_invoice()

Compute the total ht to invoice without deposit amount

Renvoie:

The HT amount in 10^5 format

Type renvoyé:

int

total_ttc_to_invoice()

Compute the total ttc to invoice without deposit amount

Renvoie:

The ttc amount in 10^5 format

Type renvoyé:

int

tva_to_invoice()

Compute the tva to invoice without deposit amount

Renvoie:

The tva amount in 10^5 format

Type renvoyé:

int

type_
class endi.models.progress_invoicing.status.ProgressInvoicingChapterStatus(**kwargs)

Bases : Base

Invoicing Status corresponding to a TaskLineGroup / Chapter

Linked to a business

Used to keep a reference to the original Estimation(s) Structure

business
business_id
classmethod get_or_create(business, task_line_group)

Retrieve or create a new status entry for the given source item

Paramètres:
  • business (obj) – The current Business we’re working in

  • task_line_group (obj) – The original Estimation’s TaskLineGroup we refer to

id
invoiced_elements
is_completely_invoiced()
product_statuses
source_task_line_group
source_task_line_group_id
sync_with_plan(progress_invoicing_plan)

Sync the current chapter status with the given plan

Generates the ProgressInvoicingChapter associated to it and all of its products

class endi.models.progress_invoicing.status.ProgressInvoicingProductStatus(**kwargs)

Bases : ProgressInvoicingBaseProductStatus

Status attached to a single product TaskLine (not one associated to a PriceStudyWorkItem)

chapter_status
chapter_status_id
id
invoiced_elements
percent_left
percent_to_invoice
source_task_line
source_task_line_id
type_
class endi.models.progress_invoicing.status.ProgressInvoicingWorkItemStatus(**kwargs)

Bases : Base

get_cost(ui_percentage, work_item, percent_left)

Compute the cost corresponding to ui_percentage for the given work_item

Paramètres:
  • ui_percentage (float) – The Percentage to compute

  • work_item (obj) – The ProgressInvoicingWorkITem asking for its cost

  • percent_left (float) – The percentage left before this work_item is invoiced

classmethod get_or_create(price_study_work_item, work_status, percent_to_invoice)

Get or create a new instance associated to a price_study_work_item and a work_status

get_percent_left()

Compute the percent left regarding the current status (also when an invoice is currently edited)

Type renvoyé:

float or None

has_deposit()

Return True if a deposit has been deduced from the original HT amount

id
invoiced_elements
invoiced_ht(work_item=None)

Compute the total ht that was already invoiced Before work_item if provided

Paramètres:

work_item (obj) – ProgressInvoicingWorkITem

invoiced_percentage(work_item=None)

Compute the percentage that was already invoiced Before work_item if provided

Paramètres:

work_item (obj) – ProgressInvoicingWorkITem

is_completely_invoiced()
percent_left
percent_to_invoice
price_study_work_item
price_study_work_item_id
sync_with_plan(progress_invoicing_work)

Sync the current work_item status with the given plan

Generates the ProgressInvoicingWorkITem

total_deposit()
total_ht_left()

Compute the total ht regarding the current status (also when an invoice is currently edited)

Type renvoyé:

int

total_ht_to_invoice()

Compute the total ht to invoice without deposit amount

Renvoie:

The HT amount in 10^5 format

Type renvoyé:

int

total_ttc_to_invoice()

Compute the total ttc to invoice without deposit amount

Renvoie:

The ttc amount in 10^5 format

Type renvoyé:

int

tva_to_invoice()

Compute the tva to invoice without deposit amount

Renvoie:

The tva amount in 10^5 format

Type renvoyé:

int

work_status
work_status_id
class endi.models.progress_invoicing.status.ProgressInvoicingWorkStatus(**kwargs)

Bases : ProgressInvoicingBaseProductStatus

chapter_status
chapter_status_id
id
invoiced_elements
item_statuses
locked
percent_left
percent_to_invoice
source_task_line
source_task_line_id
type_

Module contents