diff --git a/use_by_default_filter/README.rst b/use_by_default_filter/README.rst new file mode 100644 index 000000000..382d36c46 --- /dev/null +++ b/use_by_default_filter/README.rst @@ -0,0 +1,54 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +===================== +Use By Default Filter +===================== + +This module helps in changing any of the saved filter to default filter and vice versa on enabling a checkbox. + +Installation +============ + +- www.odoo.com/documentation/14.0/setup/install.html +- Install our custom addon + +Features +======== +* Enable the checkbox near the saved filter in search view to use it as default and disable it to change it to normal filter. +* Save multiple filters in the search view and easily make any of the filters to use as default. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +======= +GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) +(http://www.gnu.org/licenses/agpl.html) + +Credits +======= +* Developer: RAHUL C K @ Cybrosys + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com + +Bug Tracker +=========== +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +---------- +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. + +Further information +=================== +HTML Description: ``__ diff --git a/use_by_default_filter/__init__.py b/use_by_default_filter/__init__.py new file mode 100644 index 000000000..2bd81e9f3 --- /dev/null +++ b/use_by_default_filter/__init__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# you can modify it under the terms of the GNU AFFERO GENERAL +# PUBLIC LICENSE (AGPL v3), Version 3. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC +# LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## diff --git a/use_by_default_filter/__manifest__.py b/use_by_default_filter/__manifest__.py new file mode 100644 index 000000000..505ef3aa0 --- /dev/null +++ b/use_by_default_filter/__manifest__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# you can modify it under the terms of the GNU AFFERO GENERAL +# PUBLIC LICENSE (AGPL v3), Version 3. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC +# LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': 'Use By Default Filter', + 'version': '14.0.1.0.0', + 'category': 'Extra Tools', + 'summary': 'Make filter as default filter on a click.', + 'description': """ + Change filters in search view as default filter and vice versa on enabling + the checkbox + """, + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['base', 'web'], + 'data': [ + 'views/assets.xml' + ], + 'qweb': [ + 'static/src/xml/checkbox_DropdownMenuItem.xml' + ], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/use_by_default_filter/doc/RELEASE_NOTES.md b/use_by_default_filter/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..dfa3619c3 --- /dev/null +++ b/use_by_default_filter/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 19.06.2023 +#### Version 14.0.1.0.0 +#### ADD +- Initial commit for Use By Default Filter diff --git a/use_by_default_filter/static/description/banner.png b/use_by_default_filter/static/description/banner.png new file mode 100644 index 000000000..999ba4333 Binary files /dev/null and b/use_by_default_filter/static/description/banner.png differ diff --git a/use_by_default_filter/static/description/cybro_logo.png b/use_by_default_filter/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/use_by_default_filter/static/description/cybro_logo.png differ diff --git a/use_by_default_filter/static/description/icon.png b/use_by_default_filter/static/description/icon.png new file mode 100644 index 000000000..fdf35159d Binary files /dev/null and b/use_by_default_filter/static/description/icon.png differ diff --git a/use_by_default_filter/static/description/images/1.png b/use_by_default_filter/static/description/images/1.png new file mode 100644 index 000000000..1217263a6 Binary files /dev/null and b/use_by_default_filter/static/description/images/1.png differ diff --git a/use_by_default_filter/static/description/images/2.png b/use_by_default_filter/static/description/images/2.png new file mode 100644 index 000000000..6f604a403 Binary files /dev/null and b/use_by_default_filter/static/description/images/2.png differ diff --git a/use_by_default_filter/static/description/images/3.png b/use_by_default_filter/static/description/images/3.png new file mode 100644 index 000000000..6f28da108 Binary files /dev/null and b/use_by_default_filter/static/description/images/3.png differ diff --git a/use_by_default_filter/static/description/images/4.png b/use_by_default_filter/static/description/images/4.png new file mode 100644 index 000000000..3afc14722 Binary files /dev/null and b/use_by_default_filter/static/description/images/4.png differ diff --git a/use_by_default_filter/static/description/images/5.png b/use_by_default_filter/static/description/images/5.png new file mode 100644 index 000000000..cea66b05f Binary files /dev/null and b/use_by_default_filter/static/description/images/5.png differ diff --git a/use_by_default_filter/static/description/images/6.png b/use_by_default_filter/static/description/images/6.png new file mode 100644 index 000000000..0c9bb377e Binary files /dev/null and b/use_by_default_filter/static/description/images/6.png differ diff --git a/use_by_default_filter/static/description/images/checked.png b/use_by_default_filter/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/use_by_default_filter/static/description/images/checked.png differ diff --git a/use_by_default_filter/static/description/images/cybrosys.png b/use_by_default_filter/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/use_by_default_filter/static/description/images/cybrosys.png differ diff --git a/use_by_default_filter/static/description/images/hero.gif b/use_by_default_filter/static/description/images/hero.gif new file mode 100644 index 000000000..4de887813 Binary files /dev/null and b/use_by_default_filter/static/description/images/hero.gif differ diff --git a/use_by_default_filter/static/description/images/image_1.png b/use_by_default_filter/static/description/images/image_1.png new file mode 100644 index 000000000..25f4b9dee Binary files /dev/null and b/use_by_default_filter/static/description/images/image_1.png differ diff --git a/use_by_default_filter/static/description/images/image_2.png b/use_by_default_filter/static/description/images/image_2.png new file mode 100644 index 000000000..d9f664212 Binary files /dev/null and b/use_by_default_filter/static/description/images/image_2.png differ diff --git a/use_by_default_filter/static/description/images/image_3.png b/use_by_default_filter/static/description/images/image_3.png new file mode 100644 index 000000000..bcc404552 Binary files /dev/null and b/use_by_default_filter/static/description/images/image_3.png differ diff --git a/use_by_default_filter/static/description/index.html b/use_by_default_filter/static/description/index.html new file mode 100644 index 000000000..a0fb3e803 --- /dev/null +++ b/use_by_default_filter/static/description/index.html @@ -0,0 +1,448 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+
+
+
+ +
+
+
+

+ Use By Default Filter

+

+ Change a filter to default filter in a single click +

+ +
+
+ + + +
+
+

+ Overview +

+
+ +
+

+ This module helps in changing any of the saved filter to default filter and vice versa on enabling a checkbox.

+
+

+ +
+ + +
+
+

+ Features +

+
+ +
+
+

+ Community & Enterprise Support

+

+ Available in Odoo 14.0 Community and Enterprise.

+
+
+
+
+
+ + - Change saved filters to use as default filter and vice versa. +

+ - Enable the checkbox near the saved filter in search view to use it as default and disable it to change it to normal filter.

+

+ - Easily convert the normal filter to default filter by enabling the checkbox.

+

+ - Save multiple filters in the search view and easily make any of the filters to use as default.

+
+
+ +
+
+

+ Screenshots +

+
+
+

+ Save any number of filters in search view to list it under the favorites menu.

+ +
+ +
+

+ A new checkbox will be shown near each of the filter +

+ +
+ +
+

+ Enable the checkbox near any of the filter to change the filter to use it as default filter.
Disable it to change it back to normal filter.
+ Default filter will be shown every time you load the view. +

+ +
+ +
+ +
+
+

Suggested Products

+
+ + +
+
+ + + +
+

Our Service

+
+ +
+
+
+

Our Industries

+
+ +
+
+
+ +
+
+

Trading

+

Easily procure and sell your products.

+
+
+
+
+ +
+
+

Manufacturing

+

Plan, track and schedule your operations.

+
+
+
+
+ +
+
+

Restaurant

+

Run your bar or restaurant methodical.

+
+
+
+
+ +
+
+

POS

+

Easy configuring and convivial selling.

+
+
+
+
+ +
+
+

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages.

+
+
+
+
+ +
+
+

Hotel Management

+

An all-inclusive hotel management application.

+
+
+
+
+ +
+
+

Education

+

A Collaborative platform for educational management.

+
+
+
+
+ +
+
+

Service Management

+

Keep track of services and invoice accordingly.

+
+
+
+
+
+ +
+
+
+

Need Any Help?

+
+

If you have anything to share with us based on your use of this module, please let us know. We are ready to offer our support.

+
+

Email us

+

odoo@cybrosys.com

+
+
+

Contact Us

+ www.cybrosys.com +
+
+
+
+
+
+
+
+
+ +
+ + + + + + + +
+
+
+
+ \ No newline at end of file diff --git a/use_by_default_filter/static/src/js/control_panel_model_inherit.js b/use_by_default_filter/static/src/js/control_panel_model_inherit.js new file mode 100644 index 000000000..83d75eb2a --- /dev/null +++ b/use_by_default_filter/static/src/js/control_panel_model_inherit.js @@ -0,0 +1,30 @@ +odoo.define('use_by_default_filter.control_panel_model_inherit', function (require) { +'use strict'; + + const ControlPanelModelExtension = require('web/static/src/js/control_panel/control_panel_model_extension.js') + const { patch } = require('web.utils'); + const { Component, QWeb } = owl; + const components = { + ControlPanelModelExtension: require('web/static/src/js/control_panel/control_panel_model_extension.js'), + }; + + patch(components.ControlPanelModelExtension, 'use_by_default_filter.control_panel_model_inherit', { + /** + * Default filter is created when this function is called in which the details of the filter is available in the parameter item. + * + * @param {object} item Item object contains details of the filter such as description, id. + */ + async createDefFilter(item) { + const preFavorite = await this._saveQuery(item); + this.clearQuery(); + const filter = Object.assign(preFavorite, { + groupId: item.groupId, + id: item.id, + }); + this.state.filters[item.id] = filter; + this.state.query.push({ groupId: item.groupId, filterId: item.id }); + this.state.groupId++; + this.state.filterId++; + }, + }); +}); diff --git a/use_by_default_filter/static/src/js/dropdown_menu_item_inherit.js b/use_by_default_filter/static/src/js/dropdown_menu_item_inherit.js new file mode 100644 index 000000000..dace31575 --- /dev/null +++ b/use_by_default_filter/static/src/js/dropdown_menu_item_inherit.js @@ -0,0 +1,35 @@ +odoo.define('use_by_default_filter.dropdown_menu_item_inherit', function (require) { +'use strict'; + + const DropdownMenuItem = require('web.DropdownMenuItem') + const { patch } = require('web.utils'); + const { Component, QWeb } = owl; + const components = { + DropdownMenuItem: require('web.DropdownMenuItem'), + }; + patch(components.DropdownMenuItem, 'use_by_default_filter.dropdown_menu_item_inherit', { + /** + * Function will be executed when the checkbox is enabled/disabled from the view. 'if' condition will be executed when checkbox + * is enabled and 'else' will be executed when disabled. 'createDefFilter' function is called to convert filter to default filter. + * + * @param {object} props Props object contains details of the filter such as description, id. + */ + async onClickCheckBox(props) { + if(props.isActive == false){ + delete(props.isActive) + props['isDefault'] = true + this.env.searchModel.dispatch('toggleFilter', props.id); + this.env.searchModel.dispatch('createDefFilter', props); + } + else{ + delete(props.isActive) + props['isDefault'] = false + await this.env.searchModel.dispatch('createDefFilter', props); + await this.env.searchModel.dispatch('deactivateGroup', props.groupId); + location.reload(); + } + }, + }); + DropdownMenuItem.template = 'use_by_default_filter.DropdownMenuItem'; + return DropdownMenuItem; +}); diff --git a/use_by_default_filter/static/src/xml/checkbox_DropdownMenuItem.xml b/use_by_default_filter/static/src/xml/checkbox_DropdownMenuItem.xml new file mode 100644 index 000000000..680c1f00a --- /dev/null +++ b/use_by_default_filter/static/src/xml/checkbox_DropdownMenuItem.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/use_by_default_filter/views/assets.xml b/use_by_default_filter/views/assets.xml new file mode 100644 index 000000000..fbdb78666 --- /dev/null +++ b/use_by_default_filter/views/assets.xml @@ -0,0 +1,9 @@ + + +