Odoo Help

Welcome!

This community 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.

3

Auto-expand the Chart of Accounts? Possible?

By
Ray Carnes
on 3/23/14, 5:17 PM 1,939 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

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

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

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 8/13/15, 3:58 AM

Guys,

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

Hope this helps.

Thanks.

-1

Temur

--Temur--
2896
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
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,

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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