[FIX] ordering of accounts in CoA

Revive using an orderedmap when converting from a JS object to avoid
losing ordering of accounts within an account category
This commit is contained in:
Xavier Morel 2015-03-16 14:08:37 +01:00
parent 4968be3ad7
commit 9d577a0742

View File

@ -153,8 +153,8 @@
label: "Assets", label: "Assets",
BANK: { code: 11000, label: "Cash" }, BANK: { code: 11000, label: "Cash" },
ACCOUNTS_RECEIVABLE: { code: 13100, label: "Accounts Receivable" }, ACCOUNTS_RECEIVABLE: { code: 13100, label: "Accounts Receivable" },
STOCK_OUT: { code: 14600, label: "Temporary Inventory Output" },
STOCK: { code: 14000, label: "Inventory" }, STOCK: { code: 14000, label: "Inventory" },
STOCK_OUT: { code: 14600, label: "Temporary Inventory Output" },
STOCK_IN: { code: 14700, label: "Inventory Purchases" }, STOCK_IN: { code: 14700, label: "Inventory Purchases" },
BUILDINGS: { code: 17200, label: "Buildings" }, BUILDINGS: { code: 17200, label: "Buildings" },
DEPRECIATION: { code: 17800, label: "Accumulated Depreciation" }, DEPRECIATION: { code: 17800, label: "Accumulated Depreciation" },
@ -184,7 +184,11 @@
GOODS_SOLD: { code: 51100, label: "Cost of Goods Sold" }, GOODS_SOLD: { code: 51100, label: "Cost of Goods Sold" },
DEPRECIATION: { code: 52500, label: "Other Operating Expenses" } DEPRECIATION: { code: 52500, label: "Other Operating Expenses" }
}; };
var categories = Immutable.fromJS([ASSETS, LIABILITIES, EQUITY, REVENUE, EXPENSES]); var categories = Immutable.fromJS([ASSETS, LIABILITIES, EQUITY, REVENUE, EXPENSES], function (k, v) {
return Immutable.Iterable.isIndexed(v)
? v.toList()
: v.toOrderedMap();
});
var accounts = categories.toSeq().flatMap(function (cat) { var accounts = categories.toSeq().flatMap(function (cat) {
return Immutable.Seq.of(cat.set('level', 0)).concat(cat.filter(function (v, k) { return Immutable.Seq.of(cat.set('level', 0)).concat(cat.filter(function (v, k) {
return k.toUpperCase() === k; return k.toUpperCase() === k;