Skip to content

Commit

Permalink
Document type documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
RamezIssac committed May 28, 2023
1 parent f873915 commit fa3024d
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 21 deletions.
10 changes: 10 additions & 0 deletions docs/source/release_notes/release_1.5.0.rst
Original file line number Diff line number Diff line change
@@ -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/

1 change: 1 addition & 0 deletions docs/source/topics/customizing_print.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
44 changes: 44 additions & 0 deletions docs/source/topics/doc_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)


15 changes: 0 additions & 15 deletions docs/source/topics/themeing.rst

This file was deleted.

4 changes: 2 additions & 2 deletions erp_framework/__init__.py
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 2 additions & 4 deletions erp_framework/reporting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit fa3024d

Please sign in to comment.