diff --git a/web_group_expand/__init__.py b/web_group_expand/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/web_group_expand/__openerp__.py b/web_group_expand/__openerp__.py new file mode 100644 index 00000000..233dfba4 --- /dev/null +++ b/web_group_expand/__openerp__.py @@ -0,0 +1,19 @@ +{ + "name" : "Group Expand Buttons", + "category": "Hidden", + "version" : '1.0', + "author" : 'OpenERP SA', + "description": + """ +A group by list can be expanded and collapased with buttons +=============================================================== +You'll see two buttons appear on top right corner of the list when you perform a group by with which you can expand and collapse grouped records by level. + """, + "depends" : ["web"], + "js": ["static/src/js/web_group_expand.js"], + 'qweb' : ["static/src/xml/expand_buttons.xml"], + 'css' : ["static/src/css/expand_buttons.css"], + 'installable': True, + 'auto_install': False, +} + diff --git a/web_group_expand/static/description/expand_list.png b/web_group_expand/static/description/expand_list.png new file mode 100644 index 00000000..a1e15234 Binary files /dev/null and b/web_group_expand/static/description/expand_list.png differ diff --git a/web_group_expand/static/description/icon.png b/web_group_expand/static/description/icon.png new file mode 100644 index 00000000..f391ccdf Binary files /dev/null and b/web_group_expand/static/description/icon.png differ diff --git a/web_group_expand/static/description/index.html b/web_group_expand/static/description/index.html new file mode 100644 index 00000000..5e182743 --- /dev/null +++ b/web_group_expand/static/description/index.html @@ -0,0 +1,24 @@ +
+
+
+

Expand and Collapse Group By

+

A group by list can be expanded and collapased with buttons

+
+
+
+ + + + +
+
+
+

+ You'll see two buttons appear on top right corner of the list when you perform a group by with which you can expand and collapse grouped records by level. +

+ +
+
+
diff --git a/web_group_expand/static/src/css/expand_buttons.css b/web_group_expand/static/src/css/expand_buttons.css new file mode 100644 index 00000000..a878050c --- /dev/null +++ b/web_group_expand/static/src/css/expand_buttons.css @@ -0,0 +1,18 @@ + +.openerp ul#oe_group_by li.oe_group_expand{ + border: none; + border-top: 1px solid #ababab; + position:relative; + font-size:13px; + transform: rotate(90deg); + -webkit-transform: rotate(90deg); +} +.openerp hr.oe_expand_button_hr{ + height:2px; + visibility:hidden; + margin-bottom:-7px; +} +.openerp #oe_group_by_reset { + top:3px; + position:relative; +} diff --git a/web_group_expand/static/src/js/web_group_expand.js b/web_group_expand/static/src/js/web_group_expand.js new file mode 100644 index 00000000..8649b514 --- /dev/null +++ b/web_group_expand/static/src/js/web_group_expand.js @@ -0,0 +1,43 @@ +openerp.web_group_expand = function(openerp) { + var QWeb = openerp.web.qweb; + openerp.web.ViewManager.include({ + switch_mode: function(view_type, no_store, view_options) { + if (view_type != 'list' && view_type != 'tree' ) { + this.$el.find("ul#oe_group_by").remove(); + } + if(view_type == 'tree'){ + this.load_expand_buttons(); + this.$ExpandButtons.find("a#oe_group_by_reset").click(function(){ + $('.oe_open .treeview-tr.oe-treeview-first').filter(function(){return ($(this).parents('tr').attr('data-level') == 1)}).click() + }); + this.$ExpandButtons.find("a#oe_group_by_expand").click(function(){ + $('.treeview-tr.oe-treeview-first').filter(function(){return (!$(this).parents().is('.oe_open')) & ($(this).parents().css( "display" ) != 'none')}).click(); + }); + } + return this._super.apply(this, arguments); + }, + expand: function(domains, contexts, groupbys) { + this.$el.find("ul#oe_group_by").remove(); + if(groupbys.length && this.active_view == 'list') { + this.load_expand_buttons(); + this.$el.find("a#oe_group_by_reset").click(function(){ + $('span.ui-icon-triangle-1-s').click() + }); + this.$el.find("a#oe_group_by_expand").click(function(){ + $('span.ui-icon-triangle-1-e').click() + }); + } + }, + load_expand_buttons:function() { + var self = this; + this.$ExpandButtons = $(QWeb.render("GroupExpand.Buttons", {'widget':self})); + this.$el.find("ul.oe_view_manager_switch.oe_button_group.oe_right").before(this.$ExpandButtons); + }, + setup_search_view: function(view_id, search_defaults) { + self = this; + res = this._super.apply(this, arguments); + this.searchview.on('search_data', self, this.expand); + return res + }, + }) +} \ No newline at end of file diff --git a/web_group_expand/static/src/xml/expand_buttons.xml b/web_group_expand/static/src/xml/expand_buttons.xml new file mode 100644 index 00000000..2371ac82 --- /dev/null +++ b/web_group_expand/static/src/xml/expand_buttons.xml @@ -0,0 +1,8 @@ + + + + + + +