odoo-addon-web-filter-header-button 15.0.1.0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/web_filter_header_button/README.rst +139 -0
- odoo/addons/web_filter_header_button/__init__.py +0 -0
- odoo/addons/web_filter_header_button/__manifest__.py +20 -0
- odoo/addons/web_filter_header_button/demo/ir_module_module_view.xml +19 -0
- odoo/addons/web_filter_header_button/i18n/web_filter_header_button.pot +13 -0
- odoo/addons/web_filter_header_button/readme/CONFIGURE.md +32 -0
- odoo/addons/web_filter_header_button/readme/CONTEXT.md +1 -0
- odoo/addons/web_filter_header_button/readme/CONTRIBUTORS.md +2 -0
- odoo/addons/web_filter_header_button/readme/DESCRIPTION.md +1 -0
- odoo/addons/web_filter_header_button/readme/ROADMAP.md +2 -0
- odoo/addons/web_filter_header_button/readme/USAGE.md +2 -0
- odoo/addons/web_filter_header_button/static/description/icon.png +0 -0
- odoo/addons/web_filter_header_button/static/description/index.html +479 -0
- odoo/addons/web_filter_header_button/static/src/control_panel/control_panel.esm.js +11 -0
- odoo/addons/web_filter_header_button/static/src/control_panel/control_panel.xml +10 -0
- odoo/addons/web_filter_header_button/static/src/control_panel/control_panel_model_extension.esm.js +36 -0
- odoo/addons/web_filter_header_button/static/src/filter_button/filter_button.esm.js +50 -0
- odoo/addons/web_filter_header_button/static/src/filter_button/filter_button.xml +38 -0
- odoo_addon_web_filter_header_button-15.0.1.0.0.2.dist-info/METADATA +157 -0
- odoo_addon_web_filter_header_button-15.0.1.0.0.2.dist-info/RECORD +22 -0
- odoo_addon_web_filter_header_button-15.0.1.0.0.2.dist-info/WHEEL +5 -0
- odoo_addon_web_filter_header_button-15.0.1.0.0.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
=============
|
|
2
|
+
Filter Button
|
|
3
|
+
=============
|
|
4
|
+
|
|
5
|
+
..
|
|
6
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
7
|
+
!! This file is generated by oca-gen-addon-readme !!
|
|
8
|
+
!! changes will be overwritten. !!
|
|
9
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
10
|
+
!! source digest: sha256:9da8b47931a94c1b0a4f43e7a450e88a87095f7d1d6aa5fdf36fc59efbb75fe4
|
|
11
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
12
|
+
|
|
13
|
+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
|
14
|
+
:target: https://odoo-community.org/page/development-status
|
|
15
|
+
:alt: Beta
|
|
16
|
+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
|
17
|
+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
|
18
|
+
:alt: License: AGPL-3
|
|
19
|
+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
|
|
20
|
+
:target: https://github.com/OCA/web/tree/15.0/web_filter_header_button
|
|
21
|
+
:alt: OCA/web
|
|
22
|
+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
|
23
|
+
:target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_filter_header_button
|
|
24
|
+
:alt: Translate me on Weblate
|
|
25
|
+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
|
26
|
+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0
|
|
27
|
+
:alt: Try me on Runboat
|
|
28
|
+
|
|
29
|
+
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|
30
|
+
|
|
31
|
+
This module allows to add some selected filters as buttons in the header
|
|
32
|
+
control panel.
|
|
33
|
+
|
|
34
|
+
**Table of contents**
|
|
35
|
+
|
|
36
|
+
.. contents::
|
|
37
|
+
:local:
|
|
38
|
+
|
|
39
|
+
Use Cases / Context
|
|
40
|
+
===================
|
|
41
|
+
|
|
42
|
+
This developement is aimed to ease the filter access for touch screens
|
|
43
|
+
users.
|
|
44
|
+
|
|
45
|
+
Configuration
|
|
46
|
+
=============
|
|
47
|
+
|
|
48
|
+
To show a filter in the header of the views, it should have the a
|
|
49
|
+
``context`` attribute with the key ``shown_in_panel``.
|
|
50
|
+
|
|
51
|
+
.. code:: xml
|
|
52
|
+
|
|
53
|
+
<filter
|
|
54
|
+
string="My filter"
|
|
55
|
+
name="my_filter"
|
|
56
|
+
domain="[('active', '!=', False)]"
|
|
57
|
+
context="{'shown_in_panel': True}"
|
|
58
|
+
>
|
|
59
|
+
|
|
60
|
+
This will show the filter in the header with its name. You can customize
|
|
61
|
+
the button adding an icon or with a custom name passing an object to
|
|
62
|
+
that key:
|
|
63
|
+
|
|
64
|
+
.. code:: python
|
|
65
|
+
|
|
66
|
+
{'shown_in_panel': {'icon': 'fa-thumbs-up', 'name': 'Ok'}}
|
|
67
|
+
|
|
68
|
+
You might be interested in leaving just the icon. In that case, set an
|
|
69
|
+
empty string on the ``name`` property:
|
|
70
|
+
|
|
71
|
+
.. code:: python
|
|
72
|
+
|
|
73
|
+
{'shown_in_panel': {'icon': 'fa-thumbs-up', 'name': ''}}
|
|
74
|
+
|
|
75
|
+
You could also want to add a hotkey. In such case add the ``hotkey``
|
|
76
|
+
property:
|
|
77
|
+
|
|
78
|
+
.. code:: python
|
|
79
|
+
|
|
80
|
+
{'shown_in_panel': {'icon': 'fa-thumbs-up', 'hotkey': 'F'}}
|
|
81
|
+
|
|
82
|
+
You can show filter, groups or even favorites.
|
|
83
|
+
|
|
84
|
+
Usage
|
|
85
|
+
=====
|
|
86
|
+
|
|
87
|
+
There's a demo implementation in ``Apps`` and you can play around
|
|
88
|
+
following the *Configure* section.
|
|
89
|
+
|
|
90
|
+
Known issues / Roadmap
|
|
91
|
+
======================
|
|
92
|
+
|
|
93
|
+
- Group filters by kind
|
|
94
|
+
- As we use the ``context`` attribute, the inheritance could be
|
|
95
|
+
limiting in some cases. Keep it in mind or use
|
|
96
|
+
``base_view_inheritance_extension`` if you want to use proper context
|
|
97
|
+
inheritance.
|
|
98
|
+
|
|
99
|
+
Bug Tracker
|
|
100
|
+
===========
|
|
101
|
+
|
|
102
|
+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
|
103
|
+
In case of trouble, please check there if your issue has already been reported.
|
|
104
|
+
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
105
|
+
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_filter_header_button%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
|
106
|
+
|
|
107
|
+
Do not contact contributors directly about support or help with technical issues.
|
|
108
|
+
|
|
109
|
+
Credits
|
|
110
|
+
=======
|
|
111
|
+
|
|
112
|
+
Authors
|
|
113
|
+
-------
|
|
114
|
+
|
|
115
|
+
* Tecnativa
|
|
116
|
+
|
|
117
|
+
Contributors
|
|
118
|
+
------------
|
|
119
|
+
|
|
120
|
+
- `Tecnativa <https://tecnativa.com>`__
|
|
121
|
+
|
|
122
|
+
- David Vidal
|
|
123
|
+
|
|
124
|
+
Maintainers
|
|
125
|
+
-----------
|
|
126
|
+
|
|
127
|
+
This module is maintained by the OCA.
|
|
128
|
+
|
|
129
|
+
.. image:: https://odoo-community.org/logo.png
|
|
130
|
+
:alt: Odoo Community Association
|
|
131
|
+
:target: https://odoo-community.org
|
|
132
|
+
|
|
133
|
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|
134
|
+
mission is to support the collaborative development of Odoo features and
|
|
135
|
+
promote its widespread use.
|
|
136
|
+
|
|
137
|
+
This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_filter_header_button>`_ project on GitHub.
|
|
138
|
+
|
|
139
|
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2024 Tecnativa - David Vidal
|
|
2
|
+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
3
|
+
{
|
|
4
|
+
"name": "Filter Button",
|
|
5
|
+
"version": "15.0.1.0.0",
|
|
6
|
+
"summary": "Show selected filters as buttons in the control panel",
|
|
7
|
+
"author": "Tecnativa, Odoo Community Association (OCA)",
|
|
8
|
+
"license": "AGPL-3",
|
|
9
|
+
"category": "Server UX",
|
|
10
|
+
"website": "https://github.com/OCA/web",
|
|
11
|
+
"depends": ["web"],
|
|
12
|
+
"data": [],
|
|
13
|
+
"demo": [
|
|
14
|
+
"demo/ir_module_module_view.xml",
|
|
15
|
+
],
|
|
16
|
+
"assets": {
|
|
17
|
+
"web.assets_backend": ["web_filter_header_button/static/src/**/*.js"],
|
|
18
|
+
"web.assets_qweb": ["web_filter_header_button/static/src/**/*.xml"],
|
|
19
|
+
},
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
|
+
<odoo>
|
|
3
|
+
<record id="view_module_filter" model="ir.ui.view">
|
|
4
|
+
<field name="model">ir.module.module</field>
|
|
5
|
+
<field name="inherit_id" ref="base.view_module_filter" />
|
|
6
|
+
<field name="arch" type="xml">
|
|
7
|
+
<filter name="installed" position="attributes">
|
|
8
|
+
<attribute
|
|
9
|
+
name="context"
|
|
10
|
+
>{'shown_in_panel': {'icon': 'fa-toggle-on', 'hotkey': 'i'}}</attribute>
|
|
11
|
+
</filter>
|
|
12
|
+
<filter name="not_installed" position="attributes">
|
|
13
|
+
<attribute
|
|
14
|
+
name="context"
|
|
15
|
+
>{'shown_in_panel': {'icon': 'fa-toggle-off', 'hotkey': 'u'}}</attribute>
|
|
16
|
+
</filter>
|
|
17
|
+
</field>
|
|
18
|
+
</record>
|
|
19
|
+
</odoo>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Translation of Odoo Server.
|
|
2
|
+
# This file contains the translation of the following modules:
|
|
3
|
+
#
|
|
4
|
+
msgid ""
|
|
5
|
+
msgstr ""
|
|
6
|
+
"Project-Id-Version: Odoo Server 15.0\n"
|
|
7
|
+
"Report-Msgid-Bugs-To: \n"
|
|
8
|
+
"Last-Translator: \n"
|
|
9
|
+
"Language-Team: \n"
|
|
10
|
+
"MIME-Version: 1.0\n"
|
|
11
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
12
|
+
"Content-Transfer-Encoding: \n"
|
|
13
|
+
"Plural-Forms: \n"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
To show a filter in the header of the views, it should have the a `context` attribute with the key `shown_in_panel`.
|
|
2
|
+
|
|
3
|
+
```xml
|
|
4
|
+
<filter
|
|
5
|
+
string="My filter"
|
|
6
|
+
name="my_filter"
|
|
7
|
+
domain="[('active', '!=', False)]"
|
|
8
|
+
context="{'shown_in_panel': True}"
|
|
9
|
+
>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
This will show the filter in the header with its name. You can customize the button
|
|
13
|
+
adding an icon or with a custom name passing an object to that key:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
{'shown_in_panel': {'icon': 'fa-thumbs-up', 'name': 'Ok'}}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
You might be interested in leaving just the icon. In that case, set an empty string on
|
|
20
|
+
the `name` property:
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
{'shown_in_panel': {'icon': 'fa-thumbs-up', 'name': ''}}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
You could also want to add a hotkey. In such case add the `hotkey` property:
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
{'shown_in_panel': {'icon': 'fa-thumbs-up', 'hotkey': 'F'}}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
You can show filter, groups or even favorites.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This developement is aimed to ease the filter access for touch screens users.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This module allows to add some selected filters as buttons in the header control panel.
|
|
Binary file
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
|
|
7
|
+
<title>Filter Button</title>
|
|
8
|
+
<style type="text/css">
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
:Author: David Goodger (goodger@python.org)
|
|
12
|
+
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
|
|
13
|
+
:Copyright: This stylesheet has been placed in the public domain.
|
|
14
|
+
|
|
15
|
+
Default cascading style sheet for the HTML output of Docutils.
|
|
16
|
+
|
|
17
|
+
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
|
18
|
+
customize this style sheet.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/* used to remove borders from tables and images */
|
|
22
|
+
.borderless, table.borderless td, table.borderless th {
|
|
23
|
+
border: 0 }
|
|
24
|
+
|
|
25
|
+
table.borderless td, table.borderless th {
|
|
26
|
+
/* Override padding for "table.docutils td" with "! important".
|
|
27
|
+
The right padding separates the table cells. */
|
|
28
|
+
padding: 0 0.5em 0 0 ! important }
|
|
29
|
+
|
|
30
|
+
.first {
|
|
31
|
+
/* Override more specific margin styles with "! important". */
|
|
32
|
+
margin-top: 0 ! important }
|
|
33
|
+
|
|
34
|
+
.last, .with-subtitle {
|
|
35
|
+
margin-bottom: 0 ! important }
|
|
36
|
+
|
|
37
|
+
.hidden {
|
|
38
|
+
display: none }
|
|
39
|
+
|
|
40
|
+
.subscript {
|
|
41
|
+
vertical-align: sub;
|
|
42
|
+
font-size: smaller }
|
|
43
|
+
|
|
44
|
+
.superscript {
|
|
45
|
+
vertical-align: super;
|
|
46
|
+
font-size: smaller }
|
|
47
|
+
|
|
48
|
+
a.toc-backref {
|
|
49
|
+
text-decoration: none ;
|
|
50
|
+
color: black }
|
|
51
|
+
|
|
52
|
+
blockquote.epigraph {
|
|
53
|
+
margin: 2em 5em ; }
|
|
54
|
+
|
|
55
|
+
dl.docutils dd {
|
|
56
|
+
margin-bottom: 0.5em }
|
|
57
|
+
|
|
58
|
+
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
|
63
|
+
dl.docutils dt {
|
|
64
|
+
font-weight: bold }
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
div.abstract {
|
|
68
|
+
margin: 2em 5em }
|
|
69
|
+
|
|
70
|
+
div.abstract p.topic-title {
|
|
71
|
+
font-weight: bold ;
|
|
72
|
+
text-align: center }
|
|
73
|
+
|
|
74
|
+
div.admonition, div.attention, div.caution, div.danger, div.error,
|
|
75
|
+
div.hint, div.important, div.note, div.tip, div.warning {
|
|
76
|
+
margin: 2em ;
|
|
77
|
+
border: medium outset ;
|
|
78
|
+
padding: 1em }
|
|
79
|
+
|
|
80
|
+
div.admonition p.admonition-title, div.hint p.admonition-title,
|
|
81
|
+
div.important p.admonition-title, div.note p.admonition-title,
|
|
82
|
+
div.tip p.admonition-title {
|
|
83
|
+
font-weight: bold ;
|
|
84
|
+
font-family: sans-serif }
|
|
85
|
+
|
|
86
|
+
div.attention p.admonition-title, div.caution p.admonition-title,
|
|
87
|
+
div.danger p.admonition-title, div.error p.admonition-title,
|
|
88
|
+
div.warning p.admonition-title, .code .error {
|
|
89
|
+
color: red ;
|
|
90
|
+
font-weight: bold ;
|
|
91
|
+
font-family: sans-serif }
|
|
92
|
+
|
|
93
|
+
/* Uncomment (and remove this text!) to get reduced vertical space in
|
|
94
|
+
compound paragraphs.
|
|
95
|
+
div.compound .compound-first, div.compound .compound-middle {
|
|
96
|
+
margin-bottom: 0.5em }
|
|
97
|
+
|
|
98
|
+
div.compound .compound-last, div.compound .compound-middle {
|
|
99
|
+
margin-top: 0.5em }
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
div.dedication {
|
|
103
|
+
margin: 2em 5em ;
|
|
104
|
+
text-align: center ;
|
|
105
|
+
font-style: italic }
|
|
106
|
+
|
|
107
|
+
div.dedication p.topic-title {
|
|
108
|
+
font-weight: bold ;
|
|
109
|
+
font-style: normal }
|
|
110
|
+
|
|
111
|
+
div.figure {
|
|
112
|
+
margin-left: 2em ;
|
|
113
|
+
margin-right: 2em }
|
|
114
|
+
|
|
115
|
+
div.footer, div.header {
|
|
116
|
+
clear: both;
|
|
117
|
+
font-size: smaller }
|
|
118
|
+
|
|
119
|
+
div.line-block {
|
|
120
|
+
display: block ;
|
|
121
|
+
margin-top: 1em ;
|
|
122
|
+
margin-bottom: 1em }
|
|
123
|
+
|
|
124
|
+
div.line-block div.line-block {
|
|
125
|
+
margin-top: 0 ;
|
|
126
|
+
margin-bottom: 0 ;
|
|
127
|
+
margin-left: 1.5em }
|
|
128
|
+
|
|
129
|
+
div.sidebar {
|
|
130
|
+
margin: 0 0 0.5em 1em ;
|
|
131
|
+
border: medium outset ;
|
|
132
|
+
padding: 1em ;
|
|
133
|
+
background-color: #ffffee ;
|
|
134
|
+
width: 40% ;
|
|
135
|
+
float: right ;
|
|
136
|
+
clear: right }
|
|
137
|
+
|
|
138
|
+
div.sidebar p.rubric {
|
|
139
|
+
font-family: sans-serif ;
|
|
140
|
+
font-size: medium }
|
|
141
|
+
|
|
142
|
+
div.system-messages {
|
|
143
|
+
margin: 5em }
|
|
144
|
+
|
|
145
|
+
div.system-messages h1 {
|
|
146
|
+
color: red }
|
|
147
|
+
|
|
148
|
+
div.system-message {
|
|
149
|
+
border: medium outset ;
|
|
150
|
+
padding: 1em }
|
|
151
|
+
|
|
152
|
+
div.system-message p.system-message-title {
|
|
153
|
+
color: red ;
|
|
154
|
+
font-weight: bold }
|
|
155
|
+
|
|
156
|
+
div.topic {
|
|
157
|
+
margin: 2em }
|
|
158
|
+
|
|
159
|
+
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
|
160
|
+
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
|
161
|
+
margin-top: 0.4em }
|
|
162
|
+
|
|
163
|
+
h1.title {
|
|
164
|
+
text-align: center }
|
|
165
|
+
|
|
166
|
+
h2.subtitle {
|
|
167
|
+
text-align: center }
|
|
168
|
+
|
|
169
|
+
hr.docutils {
|
|
170
|
+
width: 75% }
|
|
171
|
+
|
|
172
|
+
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
|
173
|
+
clear: left ;
|
|
174
|
+
float: left ;
|
|
175
|
+
margin-right: 1em }
|
|
176
|
+
|
|
177
|
+
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
|
178
|
+
clear: right ;
|
|
179
|
+
float: right ;
|
|
180
|
+
margin-left: 1em }
|
|
181
|
+
|
|
182
|
+
img.align-center, .figure.align-center, object.align-center {
|
|
183
|
+
display: block;
|
|
184
|
+
margin-left: auto;
|
|
185
|
+
margin-right: auto;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
table.align-center {
|
|
189
|
+
margin-left: auto;
|
|
190
|
+
margin-right: auto;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.align-left {
|
|
194
|
+
text-align: left }
|
|
195
|
+
|
|
196
|
+
.align-center {
|
|
197
|
+
clear: both ;
|
|
198
|
+
text-align: center }
|
|
199
|
+
|
|
200
|
+
.align-right {
|
|
201
|
+
text-align: right }
|
|
202
|
+
|
|
203
|
+
/* reset inner alignment in figures */
|
|
204
|
+
div.align-right {
|
|
205
|
+
text-align: inherit }
|
|
206
|
+
|
|
207
|
+
/* div.align-center * { */
|
|
208
|
+
/* text-align: left } */
|
|
209
|
+
|
|
210
|
+
.align-top {
|
|
211
|
+
vertical-align: top }
|
|
212
|
+
|
|
213
|
+
.align-middle {
|
|
214
|
+
vertical-align: middle }
|
|
215
|
+
|
|
216
|
+
.align-bottom {
|
|
217
|
+
vertical-align: bottom }
|
|
218
|
+
|
|
219
|
+
ol.simple, ul.simple {
|
|
220
|
+
margin-bottom: 1em }
|
|
221
|
+
|
|
222
|
+
ol.arabic {
|
|
223
|
+
list-style: decimal }
|
|
224
|
+
|
|
225
|
+
ol.loweralpha {
|
|
226
|
+
list-style: lower-alpha }
|
|
227
|
+
|
|
228
|
+
ol.upperalpha {
|
|
229
|
+
list-style: upper-alpha }
|
|
230
|
+
|
|
231
|
+
ol.lowerroman {
|
|
232
|
+
list-style: lower-roman }
|
|
233
|
+
|
|
234
|
+
ol.upperroman {
|
|
235
|
+
list-style: upper-roman }
|
|
236
|
+
|
|
237
|
+
p.attribution {
|
|
238
|
+
text-align: right ;
|
|
239
|
+
margin-left: 50% }
|
|
240
|
+
|
|
241
|
+
p.caption {
|
|
242
|
+
font-style: italic }
|
|
243
|
+
|
|
244
|
+
p.credits {
|
|
245
|
+
font-style: italic ;
|
|
246
|
+
font-size: smaller }
|
|
247
|
+
|
|
248
|
+
p.label {
|
|
249
|
+
white-space: nowrap }
|
|
250
|
+
|
|
251
|
+
p.rubric {
|
|
252
|
+
font-weight: bold ;
|
|
253
|
+
font-size: larger ;
|
|
254
|
+
color: maroon ;
|
|
255
|
+
text-align: center }
|
|
256
|
+
|
|
257
|
+
p.sidebar-title {
|
|
258
|
+
font-family: sans-serif ;
|
|
259
|
+
font-weight: bold ;
|
|
260
|
+
font-size: larger }
|
|
261
|
+
|
|
262
|
+
p.sidebar-subtitle {
|
|
263
|
+
font-family: sans-serif ;
|
|
264
|
+
font-weight: bold }
|
|
265
|
+
|
|
266
|
+
p.topic-title {
|
|
267
|
+
font-weight: bold }
|
|
268
|
+
|
|
269
|
+
pre.address {
|
|
270
|
+
margin-bottom: 0 ;
|
|
271
|
+
margin-top: 0 ;
|
|
272
|
+
font: inherit }
|
|
273
|
+
|
|
274
|
+
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
|
275
|
+
margin-left: 2em ;
|
|
276
|
+
margin-right: 2em }
|
|
277
|
+
|
|
278
|
+
pre.code .ln { color: grey; } /* line numbers */
|
|
279
|
+
pre.code, code { background-color: #eeeeee }
|
|
280
|
+
pre.code .comment, code .comment { color: #5C6576 }
|
|
281
|
+
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
|
282
|
+
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
|
283
|
+
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
|
284
|
+
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
|
285
|
+
pre.code .inserted, code .inserted { background-color: #A3D289}
|
|
286
|
+
|
|
287
|
+
span.classifier {
|
|
288
|
+
font-family: sans-serif ;
|
|
289
|
+
font-style: oblique }
|
|
290
|
+
|
|
291
|
+
span.classifier-delimiter {
|
|
292
|
+
font-family: sans-serif ;
|
|
293
|
+
font-weight: bold }
|
|
294
|
+
|
|
295
|
+
span.interpreted {
|
|
296
|
+
font-family: sans-serif }
|
|
297
|
+
|
|
298
|
+
span.option {
|
|
299
|
+
white-space: nowrap }
|
|
300
|
+
|
|
301
|
+
span.pre {
|
|
302
|
+
white-space: pre }
|
|
303
|
+
|
|
304
|
+
span.problematic {
|
|
305
|
+
color: red }
|
|
306
|
+
|
|
307
|
+
span.section-subtitle {
|
|
308
|
+
/* font-size relative to parent (h1..h6 element) */
|
|
309
|
+
font-size: 80% }
|
|
310
|
+
|
|
311
|
+
table.citation {
|
|
312
|
+
border-left: solid 1px gray;
|
|
313
|
+
margin-left: 1px }
|
|
314
|
+
|
|
315
|
+
table.docinfo {
|
|
316
|
+
margin: 2em 4em }
|
|
317
|
+
|
|
318
|
+
table.docutils {
|
|
319
|
+
margin-top: 0.5em ;
|
|
320
|
+
margin-bottom: 0.5em }
|
|
321
|
+
|
|
322
|
+
table.footnote {
|
|
323
|
+
border-left: solid 1px black;
|
|
324
|
+
margin-left: 1px }
|
|
325
|
+
|
|
326
|
+
table.docutils td, table.docutils th,
|
|
327
|
+
table.docinfo td, table.docinfo th {
|
|
328
|
+
padding-left: 0.5em ;
|
|
329
|
+
padding-right: 0.5em ;
|
|
330
|
+
vertical-align: top }
|
|
331
|
+
|
|
332
|
+
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
|
333
|
+
font-weight: bold ;
|
|
334
|
+
text-align: left ;
|
|
335
|
+
white-space: nowrap ;
|
|
336
|
+
padding-left: 0 }
|
|
337
|
+
|
|
338
|
+
/* "booktabs" style (no vertical lines) */
|
|
339
|
+
table.docutils.booktabs {
|
|
340
|
+
border: 0px;
|
|
341
|
+
border-top: 2px solid;
|
|
342
|
+
border-bottom: 2px solid;
|
|
343
|
+
border-collapse: collapse;
|
|
344
|
+
}
|
|
345
|
+
table.docutils.booktabs * {
|
|
346
|
+
border: 0px;
|
|
347
|
+
}
|
|
348
|
+
table.docutils.booktabs th {
|
|
349
|
+
border-bottom: thin solid;
|
|
350
|
+
text-align: left;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
|
354
|
+
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
|
355
|
+
font-size: 100% }
|
|
356
|
+
|
|
357
|
+
ul.auto-toc {
|
|
358
|
+
list-style-type: none }
|
|
359
|
+
|
|
360
|
+
</style>
|
|
361
|
+
</head>
|
|
362
|
+
<body>
|
|
363
|
+
<div class="document" id="filter-button">
|
|
364
|
+
<h1 class="title">Filter Button</h1>
|
|
365
|
+
|
|
366
|
+
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
367
|
+
!! This file is generated by oca-gen-addon-readme !!
|
|
368
|
+
!! changes will be overwritten. !!
|
|
369
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
370
|
+
!! source digest: sha256:9da8b47931a94c1b0a4f43e7a450e88a87095f7d1d6aa5fdf36fc59efbb75fe4
|
|
371
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
372
|
+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/15.0/web_filter_header_button"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_filter_header_button"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
|
373
|
+
<p>This module allows to add some selected filters as buttons in the header
|
|
374
|
+
control panel.</p>
|
|
375
|
+
<p><strong>Table of contents</strong></p>
|
|
376
|
+
<div class="contents local topic" id="contents">
|
|
377
|
+
<ul class="simple">
|
|
378
|
+
<li><a class="reference internal" href="#use-cases-context" id="toc-entry-1">Use Cases / Context</a></li>
|
|
379
|
+
<li><a class="reference internal" href="#configuration" id="toc-entry-2">Configuration</a></li>
|
|
380
|
+
<li><a class="reference internal" href="#usage" id="toc-entry-3">Usage</a></li>
|
|
381
|
+
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-4">Known issues / Roadmap</a></li>
|
|
382
|
+
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-5">Bug Tracker</a></li>
|
|
383
|
+
<li><a class="reference internal" href="#credits" id="toc-entry-6">Credits</a><ul>
|
|
384
|
+
<li><a class="reference internal" href="#authors" id="toc-entry-7">Authors</a></li>
|
|
385
|
+
<li><a class="reference internal" href="#contributors" id="toc-entry-8">Contributors</a></li>
|
|
386
|
+
<li><a class="reference internal" href="#maintainers" id="toc-entry-9">Maintainers</a></li>
|
|
387
|
+
</ul>
|
|
388
|
+
</li>
|
|
389
|
+
</ul>
|
|
390
|
+
</div>
|
|
391
|
+
<div class="section" id="use-cases-context">
|
|
392
|
+
<h1><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h1>
|
|
393
|
+
<p>This developement is aimed to ease the filter access for touch screens
|
|
394
|
+
users.</p>
|
|
395
|
+
</div>
|
|
396
|
+
<div class="section" id="configuration">
|
|
397
|
+
<h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
|
|
398
|
+
<p>To show a filter in the header of the views, it should have the a
|
|
399
|
+
<tt class="docutils literal">context</tt> attribute with the key <tt class="docutils literal">shown_in_panel</tt>.</p>
|
|
400
|
+
<pre class="code xml literal-block">
|
|
401
|
+
<span class="nt"><filter</span><span class="w">
|
|
402
|
+
</span><span class="na">string=</span><span class="s">"My filter"</span><span class="w">
|
|
403
|
+
</span><span class="na">name=</span><span class="s">"my_filter"</span><span class="w">
|
|
404
|
+
</span><span class="na">domain=</span><span class="s">"[('active', '!=', False)]"</span><span class="w">
|
|
405
|
+
</span><span class="na">context=</span><span class="s">"{'shown_in_panel': True}"</span><span class="w">
|
|
406
|
+
</span><span class="nt">></span>
|
|
407
|
+
</pre>
|
|
408
|
+
<p>This will show the filter in the header with its name. You can customize
|
|
409
|
+
the button adding an icon or with a custom name passing an object to
|
|
410
|
+
that key:</p>
|
|
411
|
+
<pre class="code python literal-block">
|
|
412
|
+
<span class="p">{</span><span class="s1">'shown_in_panel'</span><span class="p">:</span> <span class="p">{</span><span class="s1">'icon'</span><span class="p">:</span> <span class="s1">'fa-thumbs-up'</span><span class="p">,</span> <span class="s1">'name'</span><span class="p">:</span> <span class="s1">'Ok'</span><span class="p">}}</span>
|
|
413
|
+
</pre>
|
|
414
|
+
<p>You might be interested in leaving just the icon. In that case, set an
|
|
415
|
+
empty string on the <tt class="docutils literal">name</tt> property:</p>
|
|
416
|
+
<pre class="code python literal-block">
|
|
417
|
+
<span class="p">{</span><span class="s1">'shown_in_panel'</span><span class="p">:</span> <span class="p">{</span><span class="s1">'icon'</span><span class="p">:</span> <span class="s1">'fa-thumbs-up'</span><span class="p">,</span> <span class="s1">'name'</span><span class="p">:</span> <span class="s1">''</span><span class="p">}}</span>
|
|
418
|
+
</pre>
|
|
419
|
+
<p>You could also want to add a hotkey. In such case add the <tt class="docutils literal">hotkey</tt>
|
|
420
|
+
property:</p>
|
|
421
|
+
<pre class="code python literal-block">
|
|
422
|
+
<span class="p">{</span><span class="s1">'shown_in_panel'</span><span class="p">:</span> <span class="p">{</span><span class="s1">'icon'</span><span class="p">:</span> <span class="s1">'fa-thumbs-up'</span><span class="p">,</span> <span class="s1">'hotkey'</span><span class="p">:</span> <span class="s1">'F'</span><span class="p">}}</span>
|
|
423
|
+
</pre>
|
|
424
|
+
<p>You can show filter, groups or even favorites.</p>
|
|
425
|
+
</div>
|
|
426
|
+
<div class="section" id="usage">
|
|
427
|
+
<h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
|
|
428
|
+
<p>There’s a demo implementation in <tt class="docutils literal">Apps</tt> and you can play around
|
|
429
|
+
following the <em>Configure</em> section.</p>
|
|
430
|
+
</div>
|
|
431
|
+
<div class="section" id="known-issues-roadmap">
|
|
432
|
+
<h1><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h1>
|
|
433
|
+
<ul class="simple">
|
|
434
|
+
<li>Group filters by kind</li>
|
|
435
|
+
<li>As we use the <tt class="docutils literal">context</tt> attribute, the inheritance could be
|
|
436
|
+
limiting in some cases. Keep it in mind or use
|
|
437
|
+
<tt class="docutils literal">base_view_inheritance_extension</tt> if you want to use proper context
|
|
438
|
+
inheritance.</li>
|
|
439
|
+
</ul>
|
|
440
|
+
</div>
|
|
441
|
+
<div class="section" id="bug-tracker">
|
|
442
|
+
<h1><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h1>
|
|
443
|
+
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
|
444
|
+
In case of trouble, please check there if your issue has already been reported.
|
|
445
|
+
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
446
|
+
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_filter_header_button%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
|
447
|
+
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
|
448
|
+
</div>
|
|
449
|
+
<div class="section" id="credits">
|
|
450
|
+
<h1><a class="toc-backref" href="#toc-entry-6">Credits</a></h1>
|
|
451
|
+
<div class="section" id="authors">
|
|
452
|
+
<h2><a class="toc-backref" href="#toc-entry-7">Authors</a></h2>
|
|
453
|
+
<ul class="simple">
|
|
454
|
+
<li>Tecnativa</li>
|
|
455
|
+
</ul>
|
|
456
|
+
</div>
|
|
457
|
+
<div class="section" id="contributors">
|
|
458
|
+
<h2><a class="toc-backref" href="#toc-entry-8">Contributors</a></h2>
|
|
459
|
+
<ul class="simple">
|
|
460
|
+
<li><a class="reference external" href="https://tecnativa.com">Tecnativa</a><ul>
|
|
461
|
+
<li>David Vidal</li>
|
|
462
|
+
</ul>
|
|
463
|
+
</li>
|
|
464
|
+
</ul>
|
|
465
|
+
</div>
|
|
466
|
+
<div class="section" id="maintainers">
|
|
467
|
+
<h2><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h2>
|
|
468
|
+
<p>This module is maintained by the OCA.</p>
|
|
469
|
+
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
|
470
|
+
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|
471
|
+
mission is to support the collaborative development of Odoo features and
|
|
472
|
+
promote its widespread use.</p>
|
|
473
|
+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/15.0/web_filter_header_button">OCA/web</a> project on GitHub.</p>
|
|
474
|
+
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
|
475
|
+
</div>
|
|
476
|
+
</div>
|
|
477
|
+
</div>
|
|
478
|
+
</body>
|
|
479
|
+
</html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @odoo-module **/
|
|
2
|
+
import {FilterButton} from "../filter_button/filter_button.esm";
|
|
3
|
+
import LegacyControlPanel from "web.ControlPanel";
|
|
4
|
+
import {patch} from "web.utils";
|
|
5
|
+
|
|
6
|
+
patch(LegacyControlPanel, "filter_button.ControlPanel", {
|
|
7
|
+
components: {
|
|
8
|
+
...LegacyControlPanel.components,
|
|
9
|
+
FilterButton,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
+
<templates>
|
|
3
|
+
<t t-inherit="web.Legacy.ControlPanel" t-inherit-mode="extension" owl="1">
|
|
4
|
+
<xpath expr="//div[hasclass('o_cp_buttons')]" position="after">
|
|
5
|
+
<t t-if="env.view.type !== 'form'">
|
|
6
|
+
<FilterButton />
|
|
7
|
+
</t>
|
|
8
|
+
</xpath>
|
|
9
|
+
</t>
|
|
10
|
+
</templates>
|
odoo/addons/web_filter_header_button/static/src/control_panel/control_panel_model_extension.esm.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @odoo-module **/
|
|
2
|
+
import LegacyControlPanelModelExtension from "web/static/src/js/control_panel/control_panel_model_extension.js";
|
|
3
|
+
import {patch} from "web.utils";
|
|
4
|
+
|
|
5
|
+
patch(
|
|
6
|
+
LegacyControlPanelModelExtension.prototype,
|
|
7
|
+
"filter_button.ControlPanelModelExtension",
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Clean the `show_in_panel` context to avoid showing it in the panel
|
|
11
|
+
* @private
|
|
12
|
+
* @override
|
|
13
|
+
* @param {Object} preFilter
|
|
14
|
+
* @returns {Promise<Object>}
|
|
15
|
+
*/
|
|
16
|
+
async _saveQuery() {
|
|
17
|
+
const preFilter = await this._super(...arguments);
|
|
18
|
+
if (preFilter && preFilter.context) {
|
|
19
|
+
delete preFilter.context.shown_in_panel;
|
|
20
|
+
}
|
|
21
|
+
return preFilter;
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Clear the `show_in_panel` context to prevent it being saved with this context
|
|
25
|
+
* @override
|
|
26
|
+
* @returns {Object}
|
|
27
|
+
*/
|
|
28
|
+
getIrFilterValues() {
|
|
29
|
+
const preFilter = this._super(...arguments);
|
|
30
|
+
if (preFilter && preFilter.context) {
|
|
31
|
+
delete preFilter.context.shown_in_panel;
|
|
32
|
+
}
|
|
33
|
+
return preFilter;
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** @odoo-module **/
|
|
2
|
+
const {Component} = owl;
|
|
3
|
+
|
|
4
|
+
export class FilterButton extends Component {
|
|
5
|
+
setup() {
|
|
6
|
+
this.model = this.env.searchModel;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Filter flagged filters to be shown in the control panel.
|
|
10
|
+
*
|
|
11
|
+
* @param {Array} filters
|
|
12
|
+
* @returns {Array}
|
|
13
|
+
*/
|
|
14
|
+
shownFilters(filters) {
|
|
15
|
+
return filters.filter((filter) => {
|
|
16
|
+
return filter.context && filter.context.shown_in_panel;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Return custom properties depending on the filter properties
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} filter
|
|
23
|
+
* @returns {Object}
|
|
24
|
+
*/
|
|
25
|
+
mapFilterType(filter) {
|
|
26
|
+
const mapping = {
|
|
27
|
+
filter: {
|
|
28
|
+
color: "primary",
|
|
29
|
+
},
|
|
30
|
+
favorite: {
|
|
31
|
+
color: "warning",
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
return mapping[filter.type];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Clear filters
|
|
38
|
+
*/
|
|
39
|
+
onClickReset() {
|
|
40
|
+
this.model.dispatch("clearQuery");
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Set / unset filter
|
|
44
|
+
* @param {Object} filter
|
|
45
|
+
*/
|
|
46
|
+
onToggleFilter(filter) {
|
|
47
|
+
this.model.dispatch("toggleFilter", filter.id);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
FilterButton.template = "filter_button.FilterButton";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
+
<templates>
|
|
3
|
+
|
|
4
|
+
<t t-name="filter_button.FilterButton" owl="1">
|
|
5
|
+
<t t-set="filters" t-value="shownFilters(model.get('filters'))" />
|
|
6
|
+
<div class="btn-group" t-if="filters">
|
|
7
|
+
<button
|
|
8
|
+
t-if="filters && filters.length"
|
|
9
|
+
t-attf-class="btn btn-outline-primary"
|
|
10
|
+
t-on-click.stop="onClickReset()"
|
|
11
|
+
>
|
|
12
|
+
<i class="fa fa-times" />
|
|
13
|
+
</button>
|
|
14
|
+
<!-- Directly get the model filters so we can react to changes -->
|
|
15
|
+
<t t-foreach="filters" t-as="filter" t-key="filter.id">
|
|
16
|
+
<t t-set="options" t-value="filter.context.shown_in_panel" />
|
|
17
|
+
<t t-set="filter_mapping" t-value="mapFilterType(filter)" />
|
|
18
|
+
<t t-set="color" t-value="filter_mapping.color || 'primary'" />
|
|
19
|
+
<!-- We can set an empty string on the optional name to show only the icon -->
|
|
20
|
+
<t
|
|
21
|
+
t-set="name"
|
|
22
|
+
t-value="options.name !== undefined ? options.name : filter.description"
|
|
23
|
+
/>
|
|
24
|
+
<button
|
|
25
|
+
t-attf-class="btn {{filter.isActive ? `btn-${color}` : `btn-outline-${color}`}}"
|
|
26
|
+
t-on-click.stop="onToggleFilter(filter)"
|
|
27
|
+
t-att-data-hotkey="options.hotkey"
|
|
28
|
+
>
|
|
29
|
+
<i
|
|
30
|
+
t-if="options.icon"
|
|
31
|
+
t-attf-class="fa {{options.icon}} {{name !== '' ? 'mr-1' : ''}}"
|
|
32
|
+
/>
|
|
33
|
+
<t t-esc="name" />
|
|
34
|
+
</button>
|
|
35
|
+
</t>
|
|
36
|
+
</div>
|
|
37
|
+
</t>
|
|
38
|
+
</templates>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: odoo-addon-web-filter-header-button
|
|
3
|
+
Version: 15.0.1.0.0.2
|
|
4
|
+
Summary: Show selected filters as buttons in the control panel
|
|
5
|
+
Home-page: https://github.com/OCA/web
|
|
6
|
+
Author: Tecnativa, Odoo Community Association (OCA)
|
|
7
|
+
Author-email: support@odoo-community.org
|
|
8
|
+
License: AGPL-3
|
|
9
|
+
Platform: UNKNOWN
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Framework :: Odoo
|
|
12
|
+
Classifier: Framework :: Odoo :: 15.0
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Requires-Dist: odoo <15.1dev,>=15.0a
|
|
16
|
+
|
|
17
|
+
=============
|
|
18
|
+
Filter Button
|
|
19
|
+
=============
|
|
20
|
+
|
|
21
|
+
..
|
|
22
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
23
|
+
!! This file is generated by oca-gen-addon-readme !!
|
|
24
|
+
!! changes will be overwritten. !!
|
|
25
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
26
|
+
!! source digest: sha256:9da8b47931a94c1b0a4f43e7a450e88a87095f7d1d6aa5fdf36fc59efbb75fe4
|
|
27
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
28
|
+
|
|
29
|
+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
|
30
|
+
:target: https://odoo-community.org/page/development-status
|
|
31
|
+
:alt: Beta
|
|
32
|
+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
|
33
|
+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
|
34
|
+
:alt: License: AGPL-3
|
|
35
|
+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
|
|
36
|
+
:target: https://github.com/OCA/web/tree/15.0/web_filter_header_button
|
|
37
|
+
:alt: OCA/web
|
|
38
|
+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
|
39
|
+
:target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_filter_header_button
|
|
40
|
+
:alt: Translate me on Weblate
|
|
41
|
+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
|
42
|
+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0
|
|
43
|
+
:alt: Try me on Runboat
|
|
44
|
+
|
|
45
|
+
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|
46
|
+
|
|
47
|
+
This module allows to add some selected filters as buttons in the header
|
|
48
|
+
control panel.
|
|
49
|
+
|
|
50
|
+
**Table of contents**
|
|
51
|
+
|
|
52
|
+
.. contents::
|
|
53
|
+
:local:
|
|
54
|
+
|
|
55
|
+
Use Cases / Context
|
|
56
|
+
===================
|
|
57
|
+
|
|
58
|
+
This developement is aimed to ease the filter access for touch screens
|
|
59
|
+
users.
|
|
60
|
+
|
|
61
|
+
Configuration
|
|
62
|
+
=============
|
|
63
|
+
|
|
64
|
+
To show a filter in the header of the views, it should have the a
|
|
65
|
+
``context`` attribute with the key ``shown_in_panel``.
|
|
66
|
+
|
|
67
|
+
.. code:: xml
|
|
68
|
+
|
|
69
|
+
<filter
|
|
70
|
+
string="My filter"
|
|
71
|
+
name="my_filter"
|
|
72
|
+
domain="[('active', '!=', False)]"
|
|
73
|
+
context="{'shown_in_panel': True}"
|
|
74
|
+
>
|
|
75
|
+
|
|
76
|
+
This will show the filter in the header with its name. You can customize
|
|
77
|
+
the button adding an icon or with a custom name passing an object to
|
|
78
|
+
that key:
|
|
79
|
+
|
|
80
|
+
.. code:: python
|
|
81
|
+
|
|
82
|
+
{'shown_in_panel': {'icon': 'fa-thumbs-up', 'name': 'Ok'}}
|
|
83
|
+
|
|
84
|
+
You might be interested in leaving just the icon. In that case, set an
|
|
85
|
+
empty string on the ``name`` property:
|
|
86
|
+
|
|
87
|
+
.. code:: python
|
|
88
|
+
|
|
89
|
+
{'shown_in_panel': {'icon': 'fa-thumbs-up', 'name': ''}}
|
|
90
|
+
|
|
91
|
+
You could also want to add a hotkey. In such case add the ``hotkey``
|
|
92
|
+
property:
|
|
93
|
+
|
|
94
|
+
.. code:: python
|
|
95
|
+
|
|
96
|
+
{'shown_in_panel': {'icon': 'fa-thumbs-up', 'hotkey': 'F'}}
|
|
97
|
+
|
|
98
|
+
You can show filter, groups or even favorites.
|
|
99
|
+
|
|
100
|
+
Usage
|
|
101
|
+
=====
|
|
102
|
+
|
|
103
|
+
There's a demo implementation in ``Apps`` and you can play around
|
|
104
|
+
following the *Configure* section.
|
|
105
|
+
|
|
106
|
+
Known issues / Roadmap
|
|
107
|
+
======================
|
|
108
|
+
|
|
109
|
+
- Group filters by kind
|
|
110
|
+
- As we use the ``context`` attribute, the inheritance could be
|
|
111
|
+
limiting in some cases. Keep it in mind or use
|
|
112
|
+
``base_view_inheritance_extension`` if you want to use proper context
|
|
113
|
+
inheritance.
|
|
114
|
+
|
|
115
|
+
Bug Tracker
|
|
116
|
+
===========
|
|
117
|
+
|
|
118
|
+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
|
119
|
+
In case of trouble, please check there if your issue has already been reported.
|
|
120
|
+
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
121
|
+
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_filter_header_button%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
|
122
|
+
|
|
123
|
+
Do not contact contributors directly about support or help with technical issues.
|
|
124
|
+
|
|
125
|
+
Credits
|
|
126
|
+
=======
|
|
127
|
+
|
|
128
|
+
Authors
|
|
129
|
+
-------
|
|
130
|
+
|
|
131
|
+
* Tecnativa
|
|
132
|
+
|
|
133
|
+
Contributors
|
|
134
|
+
------------
|
|
135
|
+
|
|
136
|
+
- `Tecnativa <https://tecnativa.com>`__
|
|
137
|
+
|
|
138
|
+
- David Vidal
|
|
139
|
+
|
|
140
|
+
Maintainers
|
|
141
|
+
-----------
|
|
142
|
+
|
|
143
|
+
This module is maintained by the OCA.
|
|
144
|
+
|
|
145
|
+
.. image:: https://odoo-community.org/logo.png
|
|
146
|
+
:alt: Odoo Community Association
|
|
147
|
+
:target: https://odoo-community.org
|
|
148
|
+
|
|
149
|
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|
150
|
+
mission is to support the collaborative development of Odoo features and
|
|
151
|
+
promote its widespread use.
|
|
152
|
+
|
|
153
|
+
This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_filter_header_button>`_ project on GitHub.
|
|
154
|
+
|
|
155
|
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
|
156
|
+
|
|
157
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
odoo/addons/web_filter_header_button/README.rst,sha256=KU5CtLil6yhvf0KAzvtjklB3ghJ1E0EuXNYdwMrhjOM,4262
|
|
2
|
+
odoo/addons/web_filter_header_button/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
odoo/addons/web_filter_header_button/__manifest__.py,sha256=vOyMFDNgAqK3jOdDEIp7fZx9iNpWzfzqzUJvRhtc4ZM,682
|
|
4
|
+
odoo/addons/web_filter_header_button/demo/ir_module_module_view.xml,sha256=zQe2NvpIVyWKfyaJTG0Zpe3D5uThcMhD0TBraVl-_nY,771
|
|
5
|
+
odoo/addons/web_filter_header_button/i18n/web_filter_header_button.pot,sha256=BIyTShSvBhiJMqh2td4QGlxB8SDDzDZd0Pqu6WZgBR8,341
|
|
6
|
+
odoo/addons/web_filter_header_button/readme/CONFIGURE.md,sha256=SpKGwfQtkRMbK0UwmZfmKfBzb-L5U1gN4rfRGaSv2WI,870
|
|
7
|
+
odoo/addons/web_filter_header_button/readme/CONTEXT.md,sha256=NYQEWUEELxH6zg7anSOwt5i-agnDwzD4lzPInzEWyhc,78
|
|
8
|
+
odoo/addons/web_filter_header_button/readme/CONTRIBUTORS.md,sha256=hiIUTi9dL2NKcUPSGgUpQ6vlpoYlo2QTxs47uWhQ0ps,53
|
|
9
|
+
odoo/addons/web_filter_header_button/readme/DESCRIPTION.md,sha256=fYs0h6UuoziMkG7YPQgXBTwgVseCh5aj-Eu2nhmGRSo,88
|
|
10
|
+
odoo/addons/web_filter_header_button/readme/ROADMAP.md,sha256=-M0sjDl60jOMcNPXMrSAwO-TAqnRfdb1ccIXIzek4qY,214
|
|
11
|
+
odoo/addons/web_filter_header_button/readme/USAGE.md,sha256=ulkajKucHaESfQRCX0ULvVdXnN4i5fGdLlUw8yjl9OQ,99
|
|
12
|
+
odoo/addons/web_filter_header_button/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
|
|
13
|
+
odoo/addons/web_filter_header_button/static/description/index.html,sha256=8usC-ZTDtcLFlGqcxZywOCvu1Rya2pzc0CvuO_iNOFQ,15852
|
|
14
|
+
odoo/addons/web_filter_header_button/static/src/control_panel/control_panel.esm.js,sha256=5P0evsMyB9hB5TBREkLDOSk6iSP3uWECnp5_LGqDBJs,322
|
|
15
|
+
odoo/addons/web_filter_header_button/static/src/control_panel/control_panel.xml,sha256=5W8nPn-PYw2ekp6Lxzv3fwVBmfWTq483wcNWP8KPUeY,340
|
|
16
|
+
odoo/addons/web_filter_header_button/static/src/control_panel/control_panel_model_extension.esm.js,sha256=MQtaNVpHm_HYXstSs5Yi5Sb6KyA32O6WSA_4EoDljR0,1170
|
|
17
|
+
odoo/addons/web_filter_header_button/static/src/filter_button/filter_button.esm.js,sha256=Img3hq8-sGz9W-rEe3O8shL7TDGYParEwZH-VLEkPlI,1178
|
|
18
|
+
odoo/addons/web_filter_header_button/static/src/filter_button/filter_button.xml,sha256=Cmwf1BBlK_xESFdsc9JTO0KYIvVVh2lgXmEap-LhPRU,1684
|
|
19
|
+
odoo_addon_web_filter_header_button-15.0.1.0.0.2.dist-info/METADATA,sha256=cBUhRjgEk4BVqKeHDTNNwknUOl9lkJCuz3eGdk-1r3s,4826
|
|
20
|
+
odoo_addon_web_filter_header_button-15.0.1.0.0.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
21
|
+
odoo_addon_web_filter_header_button-15.0.1.0.0.2.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
|
|
22
|
+
odoo_addon_web_filter_header_button-15.0.1.0.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
odoo
|