If you will be ever considering an idea to build double-entry accounting functionality in your project by your own, I have one simple thing to say: don’t do it. It’s complex, uneasy and risky. I suggest to take a look on Subledger project. Do you want to do it anyway? Okay.