A Python implementation of Accounting Patterns framework by Martin Fowler. It may not necessarily represent MF's design.
- Essentially it's a movement of money from an
Account
to another. - Movement of quantity can be expressed as
AccountingEvent
andEntry
- Movement is not always single entry.
AccountingTransaction
supports multi-legged entries. - The movement is governed by
Agreement
s andPostingRule
s. - There are 3 patterns of adjustment. A general rule is
- Cancel(Replace) -- use
ReplaceAdjustment
to remove the original transaction, and add a new one as necessary. This is possible when the original transaction (event) has no subsequent events. It's practical but not GAAP compliant. - Reverse -- add entries with negated amount. This is the most common case that keeps both of the erratic and correct entries.
- Adjust difference -- use
DifferenceAdjustment
when the original transaction is already closed, and you need to create a new entry for the adjustment.
- Cancel(Replace) -- use
See tests/electricity.py and tests/test_electricity.py
- Remove Java-ism.
- Create general purpose accouting mixin that supports any quantifiable.
-
The main article http://martinfowler.com/apsupp/accounting.pdf
-
Accounting Entry http://martinfowler.com/eaaDev/AccountingEntry.html
-
Service Agreement and Posting Rule http://martinfowler.com/eaaDev/AgreementDispatcher.html
-
Reversal Adjustment http://martinfowler.com/eaaDev/ReversalAdjustment.html
-
Replacement Adjustment http://martinfowler.com/eaaDev/ReplacementAdjustment.html
-
Difference Adjustment http://martinfowler.com/eaaDev/DifferenceAdjustment.html