Hi all, I apologize for the big commit but it was difficult to split it up into smaller chunks; the commit log should explain pretty well what I did and why; these changes were really required to improve the OFBiz GL foundations. Please review and report any issues you may find and I will fix them asap and of course feel free to ask for more details. I also decided to backport it to the 13.07 branch because it doesn't have any release and because it fixes some issues that should not be published in a new major release.
Thanks, Jacopo Begin forwarded message: > Author: jacopoc > Date: Tue Oct 8 13:49:19 2013 > New Revision: 1530273 > > URL: http://svn.apache.org/r1530273 > Log: > A pretty important refactoring of some GL data and code that fixes a series > of long standing gaps, errors and design issues affecting account balances > and the closure of fiscal periods (some of them introduced by me when I > initially wrote the first version of these business logics; at that time I > didn't have a clear and deep enough understanding of these accounting rules > sigh…). > This new version is cleaner (less code, less redundancy of information), > correct and it also resolves some pretty relevant issues (including some db > deadlock errors) affecting performance in instances with medium/high number > of GL postings. > Here is a list of changes introduced in this commit: > * removed the postedBalance field from GlAccount and GlAccountOrganization: > this was a wrong design; the field in GlAccount was not used by the > applications; the field in GlAccountOrganization was used but not consistently > * added openingBalance field to GlAccountHistory: now this entity has full > information about an account in a financial period after the period closed > (opening and ending balance, posted debits and credits); now the > endingBalance is computed correctly both for Debits and Credits accounts > * updated demo data for the data model changes mentioned above > * the business logic to compute the account balances is now implemented in a > service (computeGlAccountBalanceForTimePeriod) and reused consistently > * removed several FIXME/TODO comments now that the new code addresses the > related gaps and issues > * removed some old, incorrect or no more used artifacts: > getGlAcctgOrgWithPostedBalanceSplit (service), getNetBalance (utily methods) > * refactored the TrialBalanceReport and GlAccountTrialBalance reports and > related pdf versions: the new versions have cleaner code and show the correct > balances both for debits and credits > * fixed a series of Groovy compilation issues due to missing imports > > Modified: > ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml > ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml > ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml > > ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml > > ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml > ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml > > ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java > > ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy > > ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy > > ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy > > ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl > > ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl > ofbiz/trunk/applications/accounting/widget/AccountingTrees.xml > ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml > ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml > ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml > > ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml