Refactors journal entry lines to use single amount
Simplifies the representation of journal entry lines by replacing separate debit and credit fields with a single 'amount' field. Positive amounts represent debits, while negative amounts represent credits, aligning with Beancount's approach. This change improves code readability and simplifies calculations for balancing entries.
This commit is contained in:
parent
d0bec3ea5a
commit
4ae6a8f7d2
5 changed files with 35 additions and 45 deletions
|
|
@ -276,8 +276,8 @@ balance = BalanceCalculator.calculate_account_balance(
|
|||
|
||||
# Build inventory from entry lines
|
||||
entry_lines = [
|
||||
{"debit": 100000, "credit": 0, "metadata": '{"fiat_currency": "EUR", "fiat_amount": "50.00"}'},
|
||||
{"debit": 0, "credit": 50000, "metadata": "{}"}
|
||||
{"amount": 100000, "metadata": '{"fiat_currency": "EUR", "fiat_amount": "50.00"}'}, # Positive = debit
|
||||
{"amount": -50000, "metadata": "{}"} # Negative = credit
|
||||
]
|
||||
|
||||
inventory = BalanceCalculator.build_inventory_from_entry_lines(
|
||||
|
|
@ -306,8 +306,8 @@ entry = {
|
|||
}
|
||||
|
||||
entry_lines = [
|
||||
{"account_id": "acc1", "debit": 100000, "credit": 0},
|
||||
{"account_id": "acc2", "debit": 0, "credit": 100000}
|
||||
{"account_id": "acc1", "amount": 100000}, # Positive = debit
|
||||
{"account_id": "acc2", "amount": -100000} # Negative = credit
|
||||
]
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue