Odoo Help

3

Auto-expand the Chart of Accounts? Possible?

By
Ray Carnes
on 3/23/14, 5:17 PM 2,549 views

The Chart of Accounts by default is shown collapsed:

image description

I'd like it shown fully expanded by default, instead of requiring the user to click on all of the expand arrows:

image description

3
Ray Carnes
On 3/23/14, 5:34 PM

UPDATED 5/26/15 (I added a git compatible patch for v8)

ORIGINAL ANSWER:

----------------------------------------------------------------------------------------------------------------

This is possible by adding several lines to the view_tree.js file in web addons.

Use the following bzr patch files:

v7

=== modified file 'addons/web/static/src/js/view_tree.js'
--- addons/web/static/src/js/view_tree.js 2013-08-29 12:44:48 +0000
+++ addons/web/static/src/js/view_tree.js 2014-03-23 20:10:31 +0000
@@ -210,6 +210,11 @@
} else {
self.$el.find('tbody').html(children_rows);
}
+ _(records).each(function (record) {
+ self.records[record.id] = record;
+ children_ids = record[self.children_field];
+ self.getdata(record.id, children_ids);
+ });
});
},

v8

=== modified file 'addons/web/static/src/js/view_tree.js'
--- addons/web/static/src/js/view_tree.js 2013-09-10 12:52:23 +0000
+++ addons/web/static/src/js/view_tree.js 2014-03-23 20:13:24 +0000
@@ -213,6 +213,11 @@
} else {
self.$el.find('tbody').html(children_rows);
}
+ _(records).each(function (record) {
+ self.records[record.id] = record;
+ children_ids = record[self.children_field];
+ self.getdata(record.id, children_ids);
+ });
});
},

----------------------------------------------------------------------------------------------------------------

UPDATE:

Use the following git patch file for v8:

index 380f160..0d8a05d 100644
--- a/addons/web/static/src/js/view_tree.js
+++ b/addons/web/static/src/js/view_tree.js
@@ -213,6 +213,11 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
} else {
self.$el.find('tbody').html(children_rows);
}
+ _(records).each(function (record) {
+ self.records[record.id] = record;
+ children_ids = record[self.children_field];
+ self.getdata(record.id, children_ids);
+ });
});
},

Great post Ray!

Fabrice Henrion (fhe)
on 3/23/14, 7:16 PM

As I guess it'll affect any tree to be opened expanded, not only "Chart of Accounts" ? If so, then your question title does not exactly define what is this change for... please read my !Answer

Temur
on 9/26/14, 8:46 AM

I am now aware of any other views that are affected by this change, but this is a global change to the way certain types of views are shown.

Bista Solutions US, Ray Carnes
on 5/26/15, 2:38 PM
1
Fekete Mihai
On 9/26/14, 8:40 AM

There was for v7 a module named web_group_expand, but i don't know if it's ported to v8..you can look after it.

I've found that module in v7. it's not exactly what I'm looking for, but it may be useful and I'll check if so. thank you very much.

Temur
on 9/26/14, 8:55 AM
0

Guys,

We've added groupby expand feature on Odoo Apps Web Groupby Expand.

Hope this helps.

Thanks.

-1
Temur
On 9/26/14, 8:36 AM

Hi Ray, 

As I guess code you posted in your answer will affect any tree like structure to be opened expanded, not only "Chart of Accounts" ? If so, then your question title does not exactly define what is this change for. However It should be interesting how to do same thing really for "Chart of Accounts", not for any tree (I do not want to affect other trees). Additionally I've requirement to expand Chart of Accounts to some level (lets say 1 or 2), not Fully as it's in your case. If I expand to level 1, so on second picture in the question above, account "1" will be displayed expanded and accounts "100" and "150" collapsed. If I decide to expand to level 2, then picture in this example will be same, but if the tree has more deep, so next levels will be collapsed. i.e. if in this picture account "1399" will be of "view" type and have children, then it'll displayed collapsed and so on.  Any tips?

Regards,

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 3/23/14, 5:17 PM
Seen: 2549 times
Last updated: 10/19/15, 3:18 AM