[init/add] generic backend theme
165
muk_web_theme-19/muk_web_group/LICENSE
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
0
muk_web_theme-19/muk_web_group/__init__.py
Normal file
34
muk_web_theme-19/muk_web_group/__manifest__.py
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
'name': 'MuK Groups',
|
||||
'summary': 'Adds expand/collapse for views',
|
||||
'description': '''
|
||||
Enables you to expand and collapse groups that were created by
|
||||
grouping the data by a certain field for list and kanban views.
|
||||
''',
|
||||
'version': '19.0.1.0.0',
|
||||
'category': 'Tools/UI',
|
||||
'license': 'LGPL-3',
|
||||
'author': 'MuK IT',
|
||||
'website': 'http://www.mukit.at',
|
||||
'live_test_url': 'https://youtu.be/XiMde7ROg-kS',
|
||||
'contributors': [
|
||||
'Mathias Markl <mathias.markl@mukit.at>',
|
||||
],
|
||||
'depends': [
|
||||
'web',
|
||||
],
|
||||
'assets': {
|
||||
'web.assets_backend': [
|
||||
'/muk_web_group/static/src/**/*',
|
||||
],
|
||||
'web.assets_unit_tests': [
|
||||
'muk_web_group/static/tests/**/*',
|
||||
],
|
||||
},
|
||||
'images': [
|
||||
'static/description/banner.png',
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': False,
|
||||
}
|
||||
4
muk_web_theme-19/muk_web_group/doc/changelog.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
`1.0.0`
|
||||
-------
|
||||
|
||||
- Initial Release
|
||||
62
muk_web_theme-19/muk_web_group/doc/index.rst
Normal file
@@ -0,0 +1,62 @@
|
||||
==========
|
||||
MuK Groups
|
||||
==========
|
||||
|
||||
The extension adds one-click controls to expand or collapse all groups in
|
||||
backend list and kanban views. When a view is grouped by any field, two new
|
||||
actions *Expand All* and *Collapse All* appear in the cog menu, making it
|
||||
faster to expand large datasets or hide detail when you only need a summary.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
To install this module, you need to:
|
||||
|
||||
Download the module and add it to your Odoo addons folder. Afterward, log on to
|
||||
your Odoo server and go to the Apps menu. Trigger the debug mode and update the
|
||||
list by clicking on the "Update Apps List" link. Now install the module by
|
||||
clicking on the install button.
|
||||
|
||||
Upgrade
|
||||
============
|
||||
|
||||
To upgrade this module, you need to:
|
||||
|
||||
Download the module and add it to your Odoo addons folder. Restart the server
|
||||
and log on to your Odoo server. Select the Apps menu and upgrade the module by
|
||||
clicking on the upgrade button.
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
No additional configuration is needed to use this module.
|
||||
|
||||
Usage
|
||||
=============
|
||||
|
||||
1. Open any list or kanban view (e.g. Sales Orders, Contacts).
|
||||
2. Group the view by a field (via the search bar Group By).
|
||||
3. Click the cog menu in the view’s control panel.
|
||||
|
||||
- *Expand All* – unfold every group currently shown.
|
||||
- *Collapse All* – fold every group currently shown.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Mathias Markl <mathias.markl@mukit.at>
|
||||
|
||||
Author & Maintainer
|
||||
-------------------
|
||||
|
||||
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_.
|
||||
|
||||
MuK IT is an Austrian company specialized in customizing and extending Odoo.
|
||||
We develop custom solutions for your individual needs to help you focus on
|
||||
your strength and expertise to grow your business.
|
||||
|
||||
If you want to get in touch please contact us via mail
|
||||
(sale@mukit.at) or visit our website (https://mukit.at).
|
||||
3
muk_web_theme-19/muk_web_group/i18n/de.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
BIN
muk_web_theme-19/muk_web_group/static/description/banner.png
Normal file
|
After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 365 KiB |
BIN
muk_web_theme-19/muk_web_group/static/description/icon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="0 0 100 100" width="100pt" height="100pt"><defs><clipPath id="_clipPath_Yuq418q6kkRpC6ptYTVECmDFl5mRFiaT"><rect width="100" height="100"/></clipPath></defs><g clip-path="url(#_clipPath_Yuq418q6kkRpC6ptYTVECmDFl5mRFiaT)"><rect width="100" height="100" style="fill:rgb(0,0,0)" fill-opacity="0"/><clipPath id="_clipPath_ygSdMlYGWMy0MjXG6IaCHRxLKezsxlsO"><rect x="0" y="0" width="100" height="100" transform="matrix(1,0,0,1,0,0)" fill="rgb(255,255,255)"/></clipPath><g clip-path="url(#_clipPath_ygSdMlYGWMy0MjXG6IaCHRxLKezsxlsO)"><g><rect x="0" y="0" width="100" height="100" transform="matrix(1,0,0,1,0,0)" fill="none"/><path d=" M 64.989 0 L 94.987 0 C 97.758 0 99.987 2.229 99.987 5 L 99.987 34.998 C 99.987 37.019 98.779 38.852 96.904 39.623 C 95.029 40.394 92.883 39.977 91.446 38.54 L 83.321 30.415 L 65.197 48.539 C 63.239 50.497 60.072 50.497 58.135 48.539 L 51.469 41.873 C 49.51 39.915 49.51 36.748 51.469 34.811 L 69.593 16.687 L 61.447 8.541 C 60.01 7.104 59.593 4.958 60.364 3.083 C 61.135 1.208 62.968 0 64.989 0 Z " fill="rgb(152,81,132)"/><path d=" M 35.003 100 L 4.989 100 C 2.217 100 -0.013 97.77 -0.013 94.998 L -0.013 64.984 C -0.013 62.962 1.196 61.128 3.072 60.356 C 4.948 59.585 7.094 60.002 8.533 61.44 L 16.661 69.569 L 34.795 51.436 C 36.754 49.476 39.922 49.476 41.861 51.436 L 48.531 58.105 C 50.49 60.065 50.49 63.233 48.531 65.171 L 30.397 83.305 L 38.526 91.433 C 39.964 92.872 40.381 95.018 39.61 96.894 C 38.839 98.77 37.004 99.979 34.983 99.979 L 35.003 100 Z " fill="rgb(251,185,69)"/></g></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
139
muk_web_theme-19/muk_web_group/static/description/index.html
Normal file
@@ -0,0 +1,139 @@
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<h2 class="oe_slogan">MuK Groups</h2>
|
||||
<h3 class="oe_slogan mb-0">Adds expand/collapse for views</h3>
|
||||
<img src="logo.png" style="width: 150px;" class="mx-auto center-block">
|
||||
<h4 class="oe_slogan mt-0" style="font-size: 23px">MuK IT GmbH - www.mukit.at</h4>
|
||||
<div class="mb-4" style="text-align: center;">
|
||||
<span
|
||||
class="btn btn-sm mb-2"
|
||||
style="font-size:14px; font-weight:500; background-color:#243742; color:#fff; cursor:default;"
|
||||
>
|
||||
<i class="fa fa-check"></i> Community
|
||||
</span>
|
||||
<span
|
||||
class="btn btn-sm mb-2"
|
||||
style="font-size:14px; font-weight:500; background-color:#5D8DA8; color:#fff; cursor:default;"
|
||||
>
|
||||
<i class="fa fa-check me-1"></i> Enterprise
|
||||
</span>
|
||||
</div>
|
||||
<div class="oe_demo oe_screenshot"
|
||||
style="max-width: 84%; margin: 16px 8%">
|
||||
<img src="screenshot.png">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="text-justify" style="max-width: 84%; margin: 16px 8%;">
|
||||
<h3 class="oe_slogan">Overview</h3>
|
||||
<p class="oe_mt32">
|
||||
The extension adds one-click controls to expand or collapse all groups in
|
||||
backend list and kanban views. When a view is grouped by any field, two new
|
||||
actions <em>Expand All</em> and <em>Collapse All</em>em> appear in the cog
|
||||
menu, making it faster to expand large datasets or hide detail when you only
|
||||
need a summary.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="oe_container oe_dark d-flex justify-content-around align-items-lg-center flex-column flex-lg-row">
|
||||
<div class="d-flex flex-column m-3 ms-lg-4">
|
||||
<h3 class="oe_slogan mb-3 mt-3 text-left">
|
||||
<i class="fa fa-comments mr8"></i>Want more?
|
||||
</h3>
|
||||
<p>
|
||||
Are you having troubles with your Odoo integration? Or do you feel
|
||||
your system lacks of essential features? <br>If your answer is <b>YES</b>
|
||||
to one of the above questions, feel free to contact us at anytime
|
||||
with your inquiry. <br>We are looking forward to discuss your
|
||||
needs and plan the next steps with you. <br>
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="oe_slogan d-flex flex-column ms-1 me-1 ms-lg-4 me-lg-4 flex-grow-1">
|
||||
<a class="btn btn-primary btn-lg m-3"
|
||||
href="mailto:sale@mukit.at?subject=Request%20Quote"
|
||||
style="font-size: 1.2rem; position: relative; overflow: hidden;">
|
||||
<i class="fa fa-envelope me-1"></i>REQUEST QUOTE
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<h3 class="oe_slogan">Our Services</h3>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<div>
|
||||
<div style="width: 75px; height: 75px; border-radius: 100%; margin: auto">
|
||||
<img src="/service_development.png" style="width: 100%; border-radius: 100%">
|
||||
</div>
|
||||
<h3
|
||||
class="oe_slogan"
|
||||
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 5px; color: #000 !important; opacity: 1 !important; line-height: 17px"
|
||||
>
|
||||
Odoo <br>Development
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<div style="width: 75px; height: 75px; border-radius: 100%; margin: auto">
|
||||
<img src="/service_integration.png" style="width: 100%; border-radius: 100%">
|
||||
</div>
|
||||
<h3
|
||||
class="oe_slogan"
|
||||
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 5px; color: #000 !important; opacity: 1 !important; line-height: 17px"
|
||||
>
|
||||
Odoo <br>Integration
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<div style="width: 75px; height: 75px; border-radius: 100%; margin: auto">
|
||||
<img src="/service_infrastructure.png" style="width: 100%; border-radius: 100%">
|
||||
</div>
|
||||
<h3
|
||||
class="oe_slogan"
|
||||
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 5px; color: #000 !important; opacity: 1 !important; line-height: 17px"
|
||||
>
|
||||
Odoo <br>Infrastructure
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<div style="width: 75px; height: 75px; border-radius: 100%; margin: auto">
|
||||
<img src="/service_training.png" style="width: 100%; border-radius: 100%">
|
||||
</div>
|
||||
<h3
|
||||
class="oe_slogan"
|
||||
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 5px; color: #000 !important; opacity: 1 !important; line-height: 17px"
|
||||
>
|
||||
Odoo <br>Training
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<div style="width: 75px; height: 75px; border-radius: 100%; margin: auto">
|
||||
<img src="/service_support.png" style="width: 100%; border-radius: 100%">
|
||||
</div>
|
||||
<h3
|
||||
class="oe_slogan"
|
||||
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 5px; color: #000 !important; opacity: 1 !important; line-height: 17px"
|
||||
>
|
||||
Odoo <br>Support
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
BIN
muk_web_theme-19/muk_web_group/static/description/logo.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
muk_web_theme-19/muk_web_group/static/description/screenshot.png
Normal file
|
After Width: | Height: | Size: 610 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,45 @@
|
||||
import { Component } from '@odoo/owl';
|
||||
import { registry } from '@web/core/registry';
|
||||
import { DropdownItem } from '@web/core/dropdown/dropdown_item';
|
||||
|
||||
const cogMenuRegistry = registry.category('cogMenu');
|
||||
|
||||
export class CollapseAll extends Component {
|
||||
|
||||
static template = 'muk_web_group.CollapseAll';
|
||||
static components = { DropdownItem };
|
||||
static props = {};
|
||||
|
||||
async onCollapseButtonClicked() {
|
||||
let groups = this.env.model.root.groups;
|
||||
while (groups.length) {
|
||||
const unfoldedGroups = groups.filter(
|
||||
(group) => !group._config.isFolded
|
||||
);
|
||||
if (unfoldedGroups.length) {
|
||||
for (const group of unfoldedGroups) {
|
||||
await group.toggle();
|
||||
}
|
||||
}
|
||||
const subGroups = unfoldedGroups.map(
|
||||
(group) => group.list.groups || []
|
||||
);
|
||||
groups = subGroups.reduce(
|
||||
(a, b) => a.concat(b), []
|
||||
);
|
||||
}
|
||||
await this.env.model.root.load();
|
||||
this.env.model.notify();
|
||||
}
|
||||
}
|
||||
|
||||
export const collapseAllItem = {
|
||||
Component: CollapseAll,
|
||||
groupNumber: 15,
|
||||
isDisplayed: async (env) => (
|
||||
['kanban', 'list'].includes(env.config.viewType) &&
|
||||
env.model.root.isGrouped
|
||||
)
|
||||
};
|
||||
|
||||
cogMenuRegistry.add('collapse-all-menu', collapseAllItem, { sequence: 2 });
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="muk_web_group.CollapseAll">
|
||||
<DropdownItem
|
||||
class="'mk_collapse_all_menu'"
|
||||
onSelected.bind="onCollapseButtonClicked"
|
||||
>
|
||||
<i class="fa fa-fw fa-compress me-1"/>Collapse All
|
||||
</DropdownItem>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,45 @@
|
||||
import { Component } from '@odoo/owl';
|
||||
import { registry } from '@web/core/registry';
|
||||
import { DropdownItem } from '@web/core/dropdown/dropdown_item';
|
||||
|
||||
const cogMenuRegistry = registry.category('cogMenu');
|
||||
|
||||
export class ExpandAll extends Component {
|
||||
|
||||
static template = 'muk_web_group.ExpandAll';
|
||||
static components = { DropdownItem };
|
||||
static props = {};
|
||||
|
||||
async onExpandButtonClicked() {
|
||||
let groups = this.env.model.root.groups;
|
||||
while (groups.length) {
|
||||
const foldedGroups = groups.filter(
|
||||
(group) => group._config.isFolded
|
||||
);
|
||||
if (foldedGroups.length) {
|
||||
for (const group of foldedGroups) {
|
||||
await group.toggle();
|
||||
}
|
||||
}
|
||||
const subGroups = foldedGroups.map(
|
||||
(group) => group.list.groups || []
|
||||
);
|
||||
groups = subGroups.reduce(
|
||||
(a, b) => a.concat(b), []
|
||||
);
|
||||
}
|
||||
await this.env.model.root.load();
|
||||
this.env.model.notify();
|
||||
}
|
||||
}
|
||||
|
||||
export const expandAllItem = {
|
||||
Component: ExpandAll,
|
||||
groupNumber: 15,
|
||||
isDisplayed: async (env) => (
|
||||
['kanban', 'list'].includes(env.config.viewType) &&
|
||||
env.model.root.isGrouped
|
||||
)
|
||||
};
|
||||
|
||||
cogMenuRegistry.add('expand-all-menu', expandAllItem, { sequence: 1 });
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="muk_web_group.ExpandAll">
|
||||
<DropdownItem
|
||||
class="'mk_expand_all_menu'"
|
||||
onSelected.bind="onExpandButtonClicked"
|
||||
>
|
||||
<i class="fa fa-fw fa-expand me-1"/>Expand All
|
||||
</DropdownItem>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
52
muk_web_theme-19/muk_web_group/static/tests/group.test.js
Normal file
@@ -0,0 +1,52 @@
|
||||
import { expect, test } from '@odoo/hoot';
|
||||
import {
|
||||
models,
|
||||
fields,
|
||||
defineModels,
|
||||
mountView,
|
||||
contains,
|
||||
onRpc,
|
||||
} from '@web/../tests/web_test_helpers';
|
||||
|
||||
class Category extends models.Model {
|
||||
name = fields.Char();
|
||||
_records = [
|
||||
{ id: 1, name: 'Cat A' },
|
||||
{ id: 2, name: 'Cat B' },
|
||||
];
|
||||
}
|
||||
|
||||
class Product extends models.Model {
|
||||
name = fields.Char();
|
||||
category_id = fields.Many2one({
|
||||
relation: 'category',
|
||||
});
|
||||
_records = [
|
||||
{ id: 1, name: 'A-1', category_id: 1 },
|
||||
{ id: 2, name: 'A-2', category_id: 1 },
|
||||
{ id: 3, name: 'B-1', category_id: 2 },
|
||||
];
|
||||
}
|
||||
|
||||
defineModels({ Category, Product });
|
||||
|
||||
onRpc('has_group', () => true);
|
||||
|
||||
test('expand/collapse all groups from cog menu in grouped list', async () => {
|
||||
await mountView({
|
||||
type: 'list',
|
||||
resModel: 'product',
|
||||
groupBy: ['category_id'],
|
||||
arch: `<list string='Products'><field name='name'/><field name='category_id'/></list>`,
|
||||
});
|
||||
expect('.o_group_header').toHaveCount(2);
|
||||
await contains('.o_cp_action_menus .dropdown-toggle').click();
|
||||
expect('.mk_expand_all_menu').toHaveCount(1);
|
||||
expect('.mk_collapse_all_menu').toHaveCount(1);
|
||||
await contains('.mk_expand_all_menu').click();
|
||||
expect('tbody tr.o_data_row').toHaveCount(3);
|
||||
await contains('.o_cp_action_menus .dropdown-toggle').click();
|
||||
await contains('.mk_collapse_all_menu').click();
|
||||
expect('tbody tr.o_data_row').toHaveCount(0);
|
||||
expect('.o_group_header').toHaveCount(2);
|
||||
});
|
||||