From fa3024db444a7f5d204360ae38a224e6aac80c5c Mon Sep 17 00:00:00 2001 From: Ramez Ashraf Date: Sun, 28 May 2023 17:44:57 +0300 Subject: [PATCH] Document type documentation --- docs/source/release_notes/release_1.5.0.rst | 10 +++++ docs/source/topics/customizing_print.rst | 1 + docs/source/topics/doc_types.rst | 44 +++++++++++++++++++++ docs/source/topics/themeing.rst | 15 ------- erp_framework/__init__.py | 4 +- erp_framework/reporting/views.py | 6 +-- 6 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 docs/source/release_notes/release_1.5.0.rst delete mode 100644 docs/source/topics/themeing.rst diff --git a/docs/source/release_notes/release_1.5.0.rst b/docs/source/release_notes/release_1.5.0.rst new file mode 100644 index 0000000..40b5a80 --- /dev/null +++ b/docs/source/release_notes/release_1.5.0.rst @@ -0,0 +1,10 @@ +V1.5.0 (28 May 2023) +==================== + + +This is breaking change release. It is not compatible with previous versions. + +The project is renamed to be "Django ERP Framework". + +Documentation: http://django-erp-framework.readthedocs.org/en/latest/ + diff --git a/docs/source/topics/customizing_print.rst b/docs/source/topics/customizing_print.rst index d2a274b..ff7f912 100644 --- a/docs/source/topics/customizing_print.rst +++ b/docs/source/topics/customizing_print.rst @@ -4,3 +4,4 @@ Customizing Print Not all what is displayed on the screen can (or should be) printed. Learn how to customize how reports are printed +Coming soon diff --git a/docs/source/topics/doc_types.rst b/docs/source/topics/doc_types.rst index f8447c2..f70ae61 100644 --- a/docs/source/topics/doc_types.rst +++ b/docs/source/topics/doc_types.rst @@ -2,3 +2,47 @@ Document types =============== + +What are document types ? +------------------------- + +To answer this question we would need to go over a little of accounting and explore the idea of double entry bookkeeping. +Double entry bookkeeping is a system of accounting in which every transaction has a corresponding opposite transaction. +For example, if you buy a car for $10,000, you would record a $10,000 debit to the asset account for your car and a $10,000 credit to the cash account. +Document types are the way to define the type of transaction that is being recorded. + +This allows the reporting engine to know how to handle transactions / entries and how to compute it. + +Example: + + - A sale is a transaction that will increase the revenue account and decrease the inventory account. + - A purchase is a transaction that will increase the inventory account and decrease the cash account. + - A payment is a transaction that will decrease the cash account and decrease the accounts payable account. + +The reporting engine will use the document type to know how to compute the transaction. +ie: shall it a plus or a minus, or in accounting terms shall it be a debit or a credit. + +The ``ReportView`` have attributes that lets you control the document types . + +You can see it in action in the demo application. +In order to compute profitability , the system needed to distinguish between the expenses and the sales +Code on github : https://github.com/RamezIssac/my-shop/blob/main/general_reports/reports.py + + +.. code-block:: python + + + class MyReportView(ReportView): + + doc_type_field_name = "doc_type" + doc_type_plus_list = ['sales', 'other-revenue'] + doc_type_minus_list = ['expense', 'purchase', 'other-expense'] + + +Here the report will look at the report_model and check the doc_type_field_name (doc_type in the example above) +All the transactions that have a doc_type in the doc_type_plus_list will be added to the plus side of the report calculation +All the transactions that have a doc_type in the doc_type_minus_list will be added to the minus side of the report calculation + +This way the report will be able to compute the profit and loss of the company (or any other report that you want to create) + + diff --git a/docs/source/topics/themeing.rst b/docs/source/topics/themeing.rst deleted file mode 100644 index 57bf70e..0000000 --- a/docs/source/topics/themeing.rst +++ /dev/null @@ -1,15 +0,0 @@ -.. _theming: - -Theming -####### - -Dashboard Theme ----------------- - -Dashboard theme is mainly powered by `Django Jazzmin `_ , built on top of `AdminLTE `_ - -Check out `Django Jazzmin documentation `_ - -Theming Charts colors ----------------------- -Documentation In progress diff --git a/erp_framework/__init__.py b/erp_framework/__init__.py index 800ff25..7d66166 100644 --- a/erp_framework/__init__.py +++ b/erp_framework/__init__.py @@ -1,5 +1,5 @@ # default_app_config = "erp_framework.apps.RaConfig" -VERSION = (0, 9, 12) +VERSION = (1, 5, 0) -__version__ = "0.9.12" +__version__ = "1.5.0" diff --git a/erp_framework/reporting/views.py b/erp_framework/reporting/views.py index 2f230e7..d9fd199 100644 --- a/erp_framework/reporting/views.py +++ b/erp_framework/reporting/views.py @@ -140,7 +140,7 @@ class ReportView(UserPassesTestMixin, SlickReportViewBase): # Control the header report function must_exist_filter = None - header_report = None + # to limit records not to exceed certain number, useful for very large reports limit_records = False @@ -151,15 +151,13 @@ class ReportView(UserPassesTestMixin, SlickReportViewBase): print_buffer = 10000 # control the caching - cache = True - cache_duration = 300 + with_type = True admin_site_name = "erp_framework" template_name = "erp_framework/report.html" doc_type_field_name = "doc_type" - doc_type_plus_list = None doc_type_minus_list = None