Closed prdpspkt closed 5 months ago
@prdpspkt I think this is misunderstanding how django-hordak
works. It is double accounting tool, meaning that all transactions should have zero total balance across all accounts.
What does that mean for you is, that you have to create on another account called i.e. "Bank" and transfer the money from that account to the accounts you desire to fill with the opening balance.
What if I need to use cash then ?
I am no expert in double-entry accounting, but I don't think there is any substantial difference between cash and cashless transactions.
If there is initial balance it had to come from somewhere (e.g. one of the founders of company), so you can create an account for that and create transaction. Even if the accounting starts in the middle I think the balance taken from past time should be recorded in form of an transaction.
@prdpspkt, yes @PetrDlouhy is correct - it's a gap of understanding about double entry accounting.
Here is a more complex example of how to "start an account with existing balance".
A common way to start a Cash balance
is to debit
the Cash Account and credit
Owner's Equity.
In Hordak:
# my_model.py
class MyModel(models.Model):
self.assets_cash = model.ForeignKey(Account, on_delete=models.CASCADE, related_name='assets_cash')
self.owners_equity = model.ForeignKey(Account, on_delete=models.CASCADE, related_name='assets_cash')
def setupAccounts(self):
self.assets_cash = Account.objects.create(name="Cash", currencies=["EUR"], type=Account.TYPES.assets)
self.owners_equity = Account.objects.create(name="Owners Equity", currencies=["EUR"], type=Account.TYPES.equity)
# initial_balance.py
my_obj = MyModel.objects.all().first()
my_obj.owner_equity.accounting_transfer_to(my_obj.assets_cash, 1000, "Initial balance")
Please note I'm using accounting_transfer_to
which is a new function soon to be released.
There is no way to input the opening balance. I tried manually and it raises
Sum of transaction amounts in each currency must be 0. Currency NPR has non-zero total 10000.00 CONTEXT: PL/pgSQL function check_leg() line 22 at RAISE