mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
Merge pull request #201 from oihane/8.0-group_expand
[ADD] New module <web_group_expand>
This commit is contained in:
59
web_group_expand/README.rst
Normal file
59
web_group_expand/README.rst
Normal file
@@ -0,0 +1,59 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
:alt: License: AGPL-3
|
||||
|
||||
====================
|
||||
Group Expand Buttons
|
||||
====================
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/162/8.0
|
||||
|
||||
For further information, please visit:
|
||||
|
||||
* https://www.odoo.com/forum/help-1
|
||||
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
|
||||
`here <https://github.com/OCA/web/issues/new?body=module:%20web_group_expand%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Mantavya Gajjar <mga@openerp.com>
|
||||
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
|
||||
* Pedro Baeza <pedro.baeza@serviciosbaeza.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
To contribute to this module, please visit http://odoo-community.org.
|
||||
|
||||
0
web_group_expand/__init__.py
Normal file
0
web_group_expand/__init__.py
Normal file
19
web_group_expand/__openerp__.py
Normal file
19
web_group_expand/__openerp__.py
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Group Expand Buttons",
|
||||
"category": "Web",
|
||||
"version": "1.0",
|
||||
"author": "OpenERP SA, "
|
||||
"AvanzOSC, "
|
||||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"depends": [
|
||||
"web"
|
||||
],
|
||||
"qweb": [
|
||||
"static/src/xml/expand_buttons.xml",
|
||||
],
|
||||
"data": [
|
||||
"views/templates.xml",
|
||||
],
|
||||
"installable": True,
|
||||
}
|
||||
BIN
web_group_expand/static/description/icon.png
Normal file
BIN
web_group_expand/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
8
web_group_expand/static/src/css/expand_buttons.css
Normal file
8
web_group_expand/static/src/css/expand_buttons.css
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
.openerp ul#oe_group_by li.oe_group_expand{
|
||||
line-height: 25px;
|
||||
}
|
||||
.openerp .fa-expand, .openerp .fa-compress {
|
||||
font-size:15px;
|
||||
font-weight:bold;
|
||||
}
|
||||
44
web_group_expand/static/src/js/web_group_expand.js
Normal file
44
web_group_expand/static/src/js/web_group_expand.js
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
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) {
|
||||
var self = this;
|
||||
var res = this._super.apply(this, arguments);
|
||||
this.searchview.on('search_data', self, this.expand);
|
||||
return res
|
||||
},
|
||||
})
|
||||
}
|
||||
11
web_group_expand/static/src/xml/expand_buttons.xml
Normal file
11
web_group_expand/static/src/xml/expand_buttons.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-name="GroupExpand.Buttons">
|
||||
<div class="oe_list_buttons">
|
||||
<ul id="oe_group_by" class="oe_view_manager_switch oe_button_group oe_right">
|
||||
<li class="oe_group_expand"><a id="oe_group_by_expand"><i class="fa fa-expand" id="expand_icon" /></a></li>
|
||||
<li class="oe_group_expand"><a id="oe_group_by_reset"><i class="fa fa-compress" id="compress_icon" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
11
web_group_expand/views/templates.xml
Normal file
11
web_group_expand/views/templates.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<template id="assets_backend" name="web_groupby_expand assets" inherit_id="web.assets_backend">
|
||||
<xpath expr="." position="inside">
|
||||
<script type="text/javascript" src="/web_group_expand/static/src/js/web_group_expand.js"></script>
|
||||
<link rel="stylesheet" href="/web_group_expand/static/src/css/expand_buttons.css"/>
|
||||
</xpath>
|
||||
</template>
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user