[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
COGS incorrect when invoices are reposted
- Subject: COGS incorrect when invoices are reposted
- From: "Chris Travers" <..hidden..>
- Date: Wed, 20 Sep 2006 09:54:52 -0700
I have verified that this is also an issue with SQL-Ledger, so this
will not delay the 1.1 release (it is not trivial to fix). My own
feeling is that we need to discuss whether we want ro support
re-posting invoices at all, and if not, how we can make it easier to
properly reverse them.
LedgerSMB and SQL-Ledger de-allocate the wrong parts when an invoice
is reversed, so when the invoice is reposted, the COGS is incorrect.
This is not a matter of merely being "out of order" either.
To observe this problem, create a part.
Create invoices in the folloing order purcasing the part for different
amounts ($1, $2, $3, $4, $5, and $6). Now create invoices selling the
part at a given price. Repeat this process, selling 1 part per
invoice four times. If you check your COGS account, you will see
transactions of $1, $2, $3, and $4. Now, go back and repost the first
sales invoice, and now, the transaction for that invoice will show $4
instead of $1 (so your COGS transactions now are $4, $2, $3, and $4).
Note that this also causes the inventory accounts to be off as well.
If you now repost the second sales invoice, your COGS transactions
will show $4, $4, $3, and $4. Also not ethat this method allows you
to accidently have your inventory go negative.
The problem was verified in a public demo of SL 2.6.8 and LSMB SVN
current. The problem is caused by the db not tracking sufficient
information to tie a specific sale to a specific purchase. This
chases the FIFO inventory calcuations to be off after invoices are
reposted. This is probably worse rather than better after the 2.4
release.
I don't think this can be fixed without rewriting the entire invoicing
system, so it will have to wait for another release. But the larger
question is whether we want to support reposting invoices at all or
just make it as easy as possible to reverse invoices properly.
Best Wishes,
Chris Travers