From 9d577a0742c527b30c19ef6741b7435ddd15938d Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 16 Mar 2015 14:08:37 +0100 Subject: [PATCH] [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 --- _static/chart-of-accounts.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_static/chart-of-accounts.js b/_static/chart-of-accounts.js index 43490c0f5..32c6afccd 100644 --- a/_static/chart-of-accounts.js +++ b/_static/chart-of-accounts.js @@ -153,8 +153,8 @@ label: "Assets", BANK: { code: 11000, label: "Cash" }, ACCOUNTS_RECEIVABLE: { code: 13100, label: "Accounts Receivable" }, - STOCK_OUT: { code: 14600, label: "Temporary Inventory Output" }, STOCK: { code: 14000, label: "Inventory" }, + STOCK_OUT: { code: 14600, label: "Temporary Inventory Output" }, STOCK_IN: { code: 14700, label: "Inventory Purchases" }, BUILDINGS: { code: 17200, label: "Buildings" }, DEPRECIATION: { code: 17800, label: "Accumulated Depreciation" }, @@ -184,7 +184,11 @@ GOODS_SOLD: { code: 51100, label: "Cost of Goods Sold" }, 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) { return Immutable.Seq.of(cat.set('level', 0)).concat(cat.filter(function (v, k) { return k.toUpperCase() === k;