adamcharnock / django-hordak

Double entry accounting in Django
http://django-hordak.readthedocs.io
MIT License
228 stars 55 forks source link

Adding Accounting Fields, DR/CR #102

Closed nitsujri closed 1 week ago

nitsujri commented 10 months ago

Hi all this is my attempt at getting the ball rolling on a long term migration to DR/CR for Hordak.

Why

Reasons for changing the data model to match accounting practices are discussed elsewhere. https://github.com/adamcharnock/django-hordak/issues/44 https://github.com/adamcharnock/django-hordak/issues/59

Also, the function accounting_transfer_to, in plain english, states the direction of money transfer. FROM.accounting_transfer_to(TO). This perfectly matches CR.accounting_transfer_to(DR).

Currently

Fields/Functions

Leg

Transaction

Potential Path Forward

  1. v1.15 - Make accounting_type and accounting_amount fields optional.
  2. v2.0 - Make accounting_amount and _type required with the full deprecation of transfer_to. Change Balance, check_leg trigger, and templates to use accounting_amount.

This is an extremely rough draft, but wanted to get feedback as early as possible.

codecov-commenter commented 10 months ago

Codecov Report

Patch coverage: 83.55% and project coverage change: -0.48% :warning:

Comparison is base (79703ea) 92.97% compared to head (40efe10) 92.50%. Report is 1 commits behind head on master.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #102 +/- ## ========================================== - Coverage 92.97% 92.50% -0.48% ========================================== Files 59 60 +1 Lines 3829 3920 +91 Branches 250 215 -35 ========================================== + Hits 3560 3626 +66 - Misses 224 247 +23 - Partials 45 47 +2 ``` | [Files Changed](https://app.codecov.io/gh/adamcharnock/django-hordak/pull/102?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Charnock) | Coverage Δ | | |---|---|---| | [hordak/utilities/backfill\_accounting\_fields.py](https://app.codecov.io/gh/adamcharnock/django-hordak/pull/102?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Charnock#diff-aG9yZGFrL3V0aWxpdGllcy9iYWNrZmlsbF9hY2NvdW50aW5nX2ZpZWxkcy5weQ==) | `4.54% <4.54%> (ø)` | | | [hordak/models/core.py](https://app.codecov.io/gh/adamcharnock/django-hordak/pull/102?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Charnock#diff-aG9yZGFrL21vZGVscy9jb3JlLnB5) | `96.80% <75.00%> (-1.52%)` | :arrow_down: | | [hordak/exceptions.py](https://app.codecov.io/gh/adamcharnock/django-hordak/pull/102?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Charnock#diff-aG9yZGFrL2V4Y2VwdGlvbnMucHk=) | `100.00% <100.00%> (ø)` | | | [hordak/tests/models/test\_accounting\_tranfer\_to.py](https://app.codecov.io/gh/adamcharnock/django-hordak/pull/102?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Charnock#diff-aG9yZGFrL3Rlc3RzL21vZGVscy90ZXN0X2FjY291bnRpbmdfdHJhbmZlcl90by5weQ==) | `100.00% <100.00%> (ø)` | | | [hordak/tests/models/test\_core.py](https://app.codecov.io/gh/adamcharnock/django-hordak/pull/102?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Charnock#diff-aG9yZGFrL3Rlc3RzL21vZGVscy90ZXN0X2NvcmUucHk=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

adamcharnock commented 1 week ago

Thank you for this @nitsujri. I can see the need to present a more true-to-accounting view of the transaction data. To this end I have implemented a database view in #120, which is available as a Django model. I still favour this approach as it requires fewer/no changes to the core functionality while still providing (IMHO) a majority of the benefits.

This view will be in Hordak 2.0.0. If it still proves insufficient then we can revisit this.

I'm going to close this for now, but we can re-open it if work resumes.