Am I affected?
Books which meet these conditions are likely affected:
- Running (now or in the past) a LedgerSMB version between 1.3.41 and 1.12.11; and
- Enabled "Separation of Duties"; and
- Using "Parts" from "Goods and Services"; and
- Saving invoices multiple times before approving
Please note that "Services" are not affected.
What's the impact?
LedgerSMB has - under the 4 combined conditions mentioned above - incorrectly tracked which purchased parts are available for allocation of Cost of Goods Sold (COGS) or which sold parts still need the COGS calculation to be applied to: on Sales, parts were marked as having COGS applied when they did not, or on Purchases, parts were marked as having been used for COGS calculation when they did not. If this is the case for your books, there is impact likely on the income statement and the balance sheet.
There is impact on financial statements of affected books: after correcting the allocated numbers, the upgrade procedure will find parts in need of COGS calculation. Since this calculation should have already happened when the invoices were posted, it calculates these numbers as part of the upgrade. This will reduce inventory and increase purchase expenses. The correction is posted using the migration date as transaction date (thus: transaction date = "today").
Background
LedgerSMB keeps track of purchased and sold parts. When parts get purchased, they are added to inventory. When parts get sold, they're taken out of inventory. Their purchase price gets reported as Cost of Goods Sold at the time of sale. In practice, stock changes can happen any time. Before LedgerSMB 1.3.41, COGS was calculated when an invoice was saved. When the invoice was saved a second time, the COGS calculation was reversed before saving and re-applied after saving the invoice. Since 1.3.0, approval of a transaction (including invoices) has been a trigger for COGS calculations, if there are any to be done.
What changed in 1.3.41?
In 1.3.41, the calculation of COGS changed. The change was a fix for calculation of COGS when saving an invoice for those who use Separation of Duties. The change was faulty, because it did not incorporate the existing behavior to reverse the COGS calculation before applying it again. As a result, on each Save iteration of a Sales Invoice, more inventory is marked to have been used for COGS calculation, when in fact it has not (the associated purchase expenses have not been posted). A similar problem exists when saving Vendor Invoices.
How do I know if this applies to my books?
The 'setup.pl' application has a series of consistency checks that users are encouraged to run to understand that the data in their database is of good quality. A new consistency check has been added to 1.11.27 and 1.12.12 to help users diagnose their situation. Your books are affected if the consistency check fails.
Caution: When upgrading your database to 1.11.27 or 1.12.12 or newer, your database will have fixes applied, if you're affected. Please make backups!
In order to use the new consistency check in 1.11.27 or 1.12.12 (or newer), please make sure your database is of a new enough version. Any 1.11 version 1.11.26 (or older) or 1.12 version 1.12.11 (or older) will do. If your database is 1.3 through 1.10, upgrading to 1.12.11 is strongly advised. When your database is new enough, install version 1.11.27 (if your database is 1.11.x) or 1.12.12 (if your database is 1.12.x). Then, log in on your company database through setup.pl. Do not upgrade your database ("Upgrade or rebuild modules?"). Instead, click on the "Consistency Checks" button. If there is a red cross-out before the check named "Number of allocated purchased and sold items in COGS calculation are equal", your books are affected. When there's a green check mark, they're not.
What can I do to resolve the situation?
In case your books are affected, upgrading to 1.12.12 or 1.11.27 (or newer) will fix your books. This can include impact on your income statement, as the procedure may end up allocating COGS where it wasn't able to do so earlier, resulting in additional expenses reported. These adjustments will be posted in the current year using the day of the upgrade as the transaction date. Lines introduced during the upgrade will show "Added due to COGS adjustment at database upgrade" in the "Memo" field. The upgrade saves the unchanged data from the "invoice" table (the table used for accounting of inventory and COGS) in a table named "invoice_before_cogs_allocation_fix". A future upgrade will ask you if you want to remove this table.