[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plans for financial rewrite in 1.5



Hi Chris,


On Thu, Jan 23, 2014 at 3:48 AM, Chris Travers <..hidden..> wrote:
Hi all;

I would like to submit my plans for financial rewrite and suggest we discuss any expectations.  Existing areas of testing and what we can do to ensure they are still met will be added below.

Thanks for writing this up. My current thinking it's a good start to list the requirements. I'd like to add any requirements that we know the current system already meets, so we can be sure that a new design will not drop any of the important ones.
 
The financial rewrite will be done in such a way as to allow 1.5 to be released even if it is not complete.  However, we need to try hard to avoid making it a moving target, so hopefully this will provide some guidance there as well.

I have basically scoped out the work required, and come up with the following requirements:

1.  We need to be able to handle arbitrary two-currency or even three currency transactions.  For example, if one has one's books in USD and transferring money from a GBP to an EUR account, this must be supported.
Right. What's more, I'd like the design (although possibly not the immediate implementation) to allow for assets to be held in non-base currencies. E.g. to hold a USD current account in a company which is EUR based. Part of this requirement is the need to be able to revalue the asset -- report it as having a different current value than the value that it had when the posting was originally created. 

2.  We need to be able to handle per-transaction exchangerates.
Right. I'd say that we need a per-date default exchange-rate as well -- one that's picked up if no other exchange rate is specified.
To me, this requirement solves the following use-cases:
- different banks (or bank and credit card) with different exchange rates for the same currencies on the same date
- FX transaction reversal of a transaction in a closed period with a currency different from the current default
 
3.  For reporting and referential integrity purposes, we need a more unified database structure.  Some reports have test cases, notably the PNL reports.
I must say that it's not clear to me what you mean with this one. Could you try to explain what it is that you consider to be required here?
 
4.  For COGS tracking, we need to be able to audit how this is done, so as bugs are reported, we can track full changes of state across time.  I have COGS tests btw.
What does "audit how it's done" mean here? Do you plan to record all movements and their calculated COGS prices? Do you plan to write routines which produce intermediate results for specific transactions so transactions can be audited? Or do you mean anything else?
 
5.  We need to get rid of the silly restriction that ensures you can't have accounts in different places of the ar/ap transaction screen.
I'm not following here. Do you have a bug report or feature request to point to? Are you talking customer accounts (eca's) or gl accounts?

Other requirements I'd like to keep in place:

 * Period closing
 * Period-end/closed period balance snapshots (for performance)
 * Recurring transactions of some sort
 * automatic fx result calculation based on the fx rates of the invoice and the payment

What I think we want to get into place:

 * Period-end balance snapshots for AR/AP on a customer/eca level
   This would solve the issue that we've talked about where the "POS customer" would cumulate thousands of AR items and the POS would get slower due to that (trying to calculate the outstanding limit)
[ Another solution would be to allow a POS module *not* to use a customer ]

 * Accrual/deferral transactions
   What I mean here is that we discussed how e.g. an interest-paid-in-arrears accrues interest until the customer is really invoiced. In my current business, I have yearly payments which I distribute over the year using monthly postings. We discussed that it's possible to have accrual/deferral be part of reporting, if we would create a specific transaction type. It's definitely something I'd like to help investigate viability.

 * A functional interface (before a webservice interface), so we get per posting/transaction integrity checks in place

 * Separation of duties based on the employee: I'd like to be able to support separation of duties where two employees would be able to post to the books, but only one can post the transactions of the other. (Really: the one who last edited the transaction can't post him/her self)

 * A different workflow for handling pre-/overpayments
   Entry of overpayments should be separated from handling normal payments
   Use of overpayments should be part of the normal receipt-handling workflow 

What I think we want to drop:

 * The current recurring transaction/invoices way of working

To think about when creating our new implementation

 * A design (no implementation yet, I presume) for handling reconciliation (differently) in combination with automatic transaction import; one of the things to combine would be the experience in the US and the structure currently being implemented as part of the EU SEPA efforts



So my plan is basically as follows:

1.  Rewrite currency handling, and provide an opportunity to set per-currency allowed exchangerate variances.  This option would be initially hidden by css.  Initially I will just propagate the changes to the defaults table to avoid messing with the old code.  This will be done in trunk and affect the full release both new and old code.

2.  Write a journal entry module.  Basic test cases would be written including on the db-side posting and reversing a balanced transaction, and on the Perl side, attempting to post an unbalanced transaction (and having it fail).  I am not quite sure how to handle this in terms of save points, but this can be figured out.  Extending our current test framework to add this will not be problematic.  After this point, I would really like new reports to include logic against this db model instead of the old acc_trans tables.

3.  Port the invoice module I wrote using PGObject::Simple::Role from wxpos to Moose and move this area over.  We'd remove payment handling since that would be separate.   I don't expect this to be too hard.

4.  We'd write a new payment object model following this.  Once this is done, wxpos can take over some part of the role of a data insert tool for reports development etc.  I expect that the end result will be some of our current sql will be portable, and a lot of stuff will be rewritten.  This may be one of the harder aspects.

5.  The reconciliation module would need to be ported.  This is not likely to be too hard.  Existing reconciliation tests would be expected to pass.

6.  The financial reports would be gone through and ported over.

7.  At that point we'll branch, switch-over, make sure tests work, and pull the version with the removed code back into 1.5.

With the advancements that have taken place in 1.4, I expect 1-3 to happen fairly quickly.  The real unknowns are 4 and 6.

Then I think we need to spend a bit of time to flash out those. However, can we simply go through the other steps and address the items that I have taken up above?
 

Any feedback?





--
Bye,

Erik.

http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.