...
The link with the Source and actor won’t be in a form a database foreign keys because those could be from different table.
invoices
(editable if not payed or validated)
field | type | comment | ||||||||
HistoryBusinessModel fields | ||||||||||
subject_type | jsonstr |
| recipient | json
| ||||||
subject_id | uuid/int ? | https://stackoverflow.com/questions/33528098/django-model-one-foreign-key-to-many-tables Picker based on drop down ? (multiple picker displayed based drop down ? ) | ||||||||
recipient_type | str |
| ||||||||
recipient_id | uuid/int ? | https://stackoverflow.com/questions/33528098/django-model-one-foreign-key-to-many-tables Picker based on drop down ? (multiple picker displayed based drop down ? ) | ||||||||
code | str | or reference for the insurance (editable) | ||||||||
code_rcp | str | or reference for the recipient (editable) | ||||||||
code_ext | str | if required for external system integration such as payment systems (editable) | ||||||||
date_due | date | date on which the payment is due (editable) | ||||||||
date_invoice | date | Date of the “invoice“ (date of today but editable) | ||||||||
*dateValidFrom | date | invoice covering service/item from (editable) | ||||||||
*dateValidTo | date | invoice covering service/item to (editable) | ||||||||
date_payed | date | Date on which the payment was actually documented as Done (editable) | ||||||||
amount_discount | float | total of the detail discount (calculated be) | ||||||||
amount_net | float | Total without tax (calculated be) | ||||||||
tax_analysis | json |
| ||||||||
amount_total | float | total net + tax total (calculated be) | ||||||||
status | int | ENUM: draft, validated, payed, cancelled, deleted (editable ) | ||||||||
currency_rcp_code | str | currency of the recipient (if different) (hidden) | ||||||||
currency_code | str | currency of insurance (calculated be) (hidden) | ||||||||
note | bigttext | (editable) | ||||||||
terms | bigttext | conditions (editable) |
invoiceLineItems
to document the content for the Invoice (editable if invoice not payed or validated)
field | type | comment | |||||
HistoryBusinessModel fields | |||||||
code | str | reference (editable) | |||||
invoiceId | UUID | reference to invoice (hidden) | |||||
description | str | (editable) | |||||
details | json | depend of the type, TBD (editable as text) if not json wrap it in {'text':DATA} ← quote must be escaped | |||||
ledger_account | int str | from specific payment module (editable) | |||||
quantity | float | (editable) | |||||
unit_price | type | (editable) | |||||
discount | float | to document difference between the std price and the price to be paid, useful for relative pricing (editable) | |||||
tax_rate | Calculation uuid | Calculation to calculate the tax (picker, rule type: tax, subtype *) | |||||
tax_analysis | json |
| |||||
amount_total | float | net +tax (calculated be, updated fe after saving line) | |||||
amount_net | qty * unitprice - discount (calculated be/, updated fe after saving line) |
InvoicePayments
To document the payment done on the invoice. out of scope: a payment done for 2 invoice, to support such scenario an “generalPayment“ table need to be created, this table will have sub table with relationships to invoicePayments, once the reconciliation between the different invoice will be done.
...
invoicePaymentRefRecieved
invoicePaymentRejected
invoicePaymentRecieved
invoicePaymentRefunded
invoiceCreate (called on save)
invoiceUpdate (called on save)
invoiceDelete
invoiceTaxCalculation
invoiceItemCreate
invoiceItemUpdate
invoiceItemDelete
invoiceItemTaxCalculation
invoiceAmend
invoiceValidateItems
invoiceMatchItems
invoiceCreationFromCalculation (will send a signal)
...