diff --git a/pivot_conditional_formatting/README.rst b/pivot_conditional_formatting/README.rst new file mode 100644 index 000000000..7d31aa443 --- /dev/null +++ b/pivot_conditional_formatting/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Conditional Formatting in Pivot View +==================================== +This module helps you to setup conditional formatting in the pivot view of a +model. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (AGPL v3). +(http://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developers: (V16) Muhammed Rishad +* Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://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 `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/pivot_conditional_formatting/__init__.py b/pivot_conditional_formatting/__init__.py new file mode 100644 index 000000000..d15f8e60f --- /dev/null +++ b/pivot_conditional_formatting/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions () +# +# You can modify it under the terms of the GNU LESSER +# 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 LESSER GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program +# If not, see . +# +############################################################################# +"""init file""" +from . import models diff --git a/pivot_conditional_formatting/__manifest__.py b/pivot_conditional_formatting/__manifest__.py new file mode 100644 index 000000000..bdecc1a4b --- /dev/null +++ b/pivot_conditional_formatting/__manifest__.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions () +# +# You can modify it under the terms of the GNU LESSER +# 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 LESSER GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program +# If not, see . +# +############################################################################# +# """manifest""" +{ + "name": "Conditional Formatting in Pivot View", + "version": "16.0.1.0.0", + "category": "Extra Tools", + "summary": "This Module allows to setup conditional formatting in " + "the pivot view of models", + "description": "The module is used for using conditional formatting option" + "in the pivot view of different models, you can setup" + " default formatting rules in the settings or add new rules" + " from the UI.", + "author": "Cybrosys Techno Solutions", + "company": "Cybrosys Techno Solutions", + "maintainer": "Cybrosys Techno Solutions", + "website": "https://www.cybrosys.com", + "depends": ["base", "web"], + "data": [ + "security/pivot_conditional_formatting_groups.xml", + "security/pivot_conditional_settings_security.xml", + "security/ir.model.access.csv", + "views/pivot_conditional_settings_views.xml", + ], + "assets": { + "web.assets_backend": [ + "pivot_conditional_formatting/static/src/xml/pivot_conditional_formatting.xml", + "pivot_conditional_formatting/static/src/css/pivot_conditional_formatting.css", + "pivot_conditional_formatting/static/src/js/pivot_conditional_formatting.js", + ], + }, + "images": ["static/description/banner.png"], + "license": "AGPL-3", + "installable": True, + "auto_install": False, + "application": False, +} diff --git a/pivot_conditional_formatting/doc/RELEASE_NOTES.md b/pivot_conditional_formatting/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..9ef0733bc --- /dev/null +++ b/pivot_conditional_formatting/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 20.11.2023 +#### Version 16.0.1.0.0 +#### ADD +- Initial Commit for Conditional Formatting in Pivot View diff --git a/pivot_conditional_formatting/models/__init__.py b/pivot_conditional_formatting/models/__init__.py new file mode 100644 index 000000000..ddaa9cff7 --- /dev/null +++ b/pivot_conditional_formatting/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions () +# +# You can modify it under the terms of the GNU LESSER +# 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 LESSER GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program +# If not, see . +# +############################################################################# +"""init file""" +from . import pivot_conditional_settings diff --git a/pivot_conditional_formatting/models/pivot_conditional_settings.py b/pivot_conditional_formatting/models/pivot_conditional_settings.py new file mode 100644 index 000000000..601dafac7 --- /dev/null +++ b/pivot_conditional_formatting/models/pivot_conditional_settings.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions () +# +# You can modify it under the terms of the GNU LESSER +# 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 LESSER GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program +# If not, see . +# +############################################################################# +"""Models for setting conditional formatting rules in settings""" +from odoo import api, fields, models + + +class PivotConditionalSetting(models.Model): + """Model Class for choosing the model and view to set the default rules""" + _name = 'pivot.conditional.settings' + _description = 'Pivot conditional setting' + _rec_name = "model_id" + + model_id = fields.Many2one('ir.model', help="The model to set the rules " + "for", string="Model") + view_id = fields.Many2one('ir.ui.view', help="Pivot view of the model", + string="View") + rules_ids = fields.One2many('conditional.rules', 'conditional_id', + help="List View Showing details of different" + " rules", string="Rules") + company_id = fields.Many2one('res.company', string='Company', + default=lambda self: self.env.company, + help="Company id related to the " + "Pivot Condition setting") + + @api.onchange('model_id') + def _onchange_model_id(self): + """ + This method is called when the 'model_id' field is changed. It + updates the domain of the 'view_id' field to filter records based + on the selected model and view type as 'pivot'. + + :return: Dictionary containing the updated domain for the 'view_id' + field. + :rtype: dict + """ + return {'domain': {'view_id': [('model', '=', self.model_id.model), + ('type', '=', 'pivot')]}} + + +class ConditionalRules(models.Model): + """Model Class for the different Pivot view table, conditional formatting + rules""" + _name = 'conditional.rules' + _description = 'Conditional formatting' + _rec_name = "rule" + + rule = fields.Selection(string='Rule', selection=([ + ('greater_than', 'Greater than'), ('less_than', 'Less Than'), + ('is_empty', 'Is Empty'), ('in_between', 'In Between')]), + help="Different conditions for rules") + + value = fields.Float(string='Value', help="Value for comparing the rule") + second_value = fields.Float(string='Second Value', help="Second Value for " + "comparing the " + "inbetween rule") + color = fields.Char(string='Color', required=True, help="Background " + "Color For the " + "Cells") + text_color = fields.Char(string='Text Color', + required=True, help="Text " + "Color for the cells") + model_id = fields.Many2one('ir.model', related='conditional_id.model_id', + help="model related to the rule", + string="Model") + view_id = fields.Many2one('ir.ui.view', related='conditional_id.view_id', + help="view related to the rule", string="View") + conditional_id = fields.Many2one('pivot.conditional.settings', + help="Pivot Condition setting related to" + " the rule", string="Condition") + company_id = fields.Many2one('res.company', string='Company', + default=lambda self: self.env.company, + help="Company id related to rule") diff --git a/pivot_conditional_formatting/security/ir.model.access.csv b/pivot_conditional_formatting/security/ir.model.access.csv new file mode 100644 index 000000000..0c142e685 --- /dev/null +++ b/pivot_conditional_formatting/security/ir.model.access.csv @@ -0,0 +1,5 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_conditional_rules_user,access.conditional.rules,model_conditional_rules,pivot_conditional_formatting.pivot_conditional_settings_group_user,1,1,1,1 +access_conditional_rules_reader,access.conditional.rules,model_conditional_rules,base.group_user,1,0,0,0 +access_pivot_conditional_settings_user,access.pivot.conditional.settings,model_pivot_conditional_settings,pivot_conditional_formatting.pivot_conditional_settings_group_user,1,1,1,1 +access_pivot_conditional_settings_reader,access.pivot.conditional.settings,model_pivot_conditional_settings,base.group_user,1,0,0,0 diff --git a/pivot_conditional_formatting/security/pivot_conditional_formatting_groups.xml b/pivot_conditional_formatting/security/pivot_conditional_formatting_groups.xml new file mode 100644 index 000000000..4884723ea --- /dev/null +++ b/pivot_conditional_formatting/security/pivot_conditional_formatting_groups.xml @@ -0,0 +1,8 @@ + + + + + Allow to Set Pivot Conditional Rules + + + diff --git a/pivot_conditional_formatting/security/pivot_conditional_settings_security.xml b/pivot_conditional_formatting/security/pivot_conditional_settings_security.xml new file mode 100644 index 000000000..bfeba7993 --- /dev/null +++ b/pivot_conditional_formatting/security/pivot_conditional_settings_security.xml @@ -0,0 +1,15 @@ + + + + + Pivot Conditional Formatting Rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + + Pivot Conditional Formatting Rule2 + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/check.png b/pivot_conditional_formatting/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/check.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/chevron.png b/pivot_conditional_formatting/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/chevron.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/cogs.png b/pivot_conditional_formatting/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/cogs.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/consultation.png b/pivot_conditional_formatting/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/consultation.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/ecom-black.png b/pivot_conditional_formatting/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/ecom-black.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/education-black.png b/pivot_conditional_formatting/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/education-black.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/hotel-black.png b/pivot_conditional_formatting/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/hotel-black.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/license.png b/pivot_conditional_formatting/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/license.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/lifebuoy.png b/pivot_conditional_formatting/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/lifebuoy.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/logo.png b/pivot_conditional_formatting/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/logo.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/manufacturing-black.png b/pivot_conditional_formatting/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/manufacturing-black.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/pos-black.png b/pivot_conditional_formatting/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/pos-black.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/puzzle.png b/pivot_conditional_formatting/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/puzzle.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/restaurant-black.png b/pivot_conditional_formatting/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/restaurant-black.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/service-black.png b/pivot_conditional_formatting/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/service-black.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/trading-black.png b/pivot_conditional_formatting/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/trading-black.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/training.png b/pivot_conditional_formatting/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/training.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/update.png b/pivot_conditional_formatting/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/update.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/user.png b/pivot_conditional_formatting/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/user.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/wrench.png b/pivot_conditional_formatting/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/wrench.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/categories.png b/pivot_conditional_formatting/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/categories.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/check-box.png b/pivot_conditional_formatting/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/check-box.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/compass.png b/pivot_conditional_formatting/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/compass.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/corporate.png b/pivot_conditional_formatting/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/corporate.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/customer-support.png b/pivot_conditional_formatting/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/customer-support.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/cybrosys-logo.png b/pivot_conditional_formatting/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/cybrosys-logo.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/features.png b/pivot_conditional_formatting/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/features.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/logo.png b/pivot_conditional_formatting/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/logo.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/pictures.png b/pivot_conditional_formatting/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/pictures.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/pie-chart.png b/pivot_conditional_formatting/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/pie-chart.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/right-arrow.png b/pivot_conditional_formatting/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/right-arrow.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/star.png b/pivot_conditional_formatting/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/star.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/support.png b/pivot_conditional_formatting/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/support.png differ diff --git a/pivot_conditional_formatting/static/description/assets/misc/whatsapp.png b/pivot_conditional_formatting/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/misc/whatsapp.png differ diff --git a/pivot_conditional_formatting/static/description/assets/modules/1.png b/pivot_conditional_formatting/static/description/assets/modules/1.png new file mode 100644 index 000000000..51555e88c Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/1.png differ diff --git a/pivot_conditional_formatting/static/description/assets/modules/2.png b/pivot_conditional_formatting/static/description/assets/modules/2.png new file mode 100644 index 000000000..7cc3625c7 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/2.png differ diff --git a/pivot_conditional_formatting/static/description/assets/modules/3.png b/pivot_conditional_formatting/static/description/assets/modules/3.png new file mode 100644 index 000000000..f3c986fc1 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/3.png differ diff --git a/pivot_conditional_formatting/static/description/assets/modules/4.png b/pivot_conditional_formatting/static/description/assets/modules/4.png new file mode 100644 index 000000000..2c8fbb83f Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/4.png differ diff --git a/pivot_conditional_formatting/static/description/assets/modules/5.png b/pivot_conditional_formatting/static/description/assets/modules/5.png new file mode 100644 index 000000000..868337819 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/5.png differ diff --git a/pivot_conditional_formatting/static/description/assets/modules/6.png b/pivot_conditional_formatting/static/description/assets/modules/6.png new file mode 100644 index 000000000..29a17f2be Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/6.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/hero.gif b/pivot_conditional_formatting/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..4de8933c3 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/hero.gif differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/ss1.png b/pivot_conditional_formatting/static/description/assets/screenshots/ss1.png new file mode 100644 index 000000000..00f34f06e Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/ss1.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/ss2.png b/pivot_conditional_formatting/static/description/assets/screenshots/ss2.png new file mode 100644 index 000000000..33f448af1 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/ss2.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/ss3.png b/pivot_conditional_formatting/static/description/assets/screenshots/ss3.png new file mode 100644 index 000000000..af8849a58 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/ss3.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/ss4.png b/pivot_conditional_formatting/static/description/assets/screenshots/ss4.png new file mode 100644 index 000000000..e8aa03a88 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/ss4.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/ss5.png b/pivot_conditional_formatting/static/description/assets/screenshots/ss5.png new file mode 100644 index 000000000..eb444ccc8 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/ss5.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/ss6.png b/pivot_conditional_formatting/static/description/assets/screenshots/ss6.png new file mode 100644 index 000000000..2fa24db11 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/ss6.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/ss7.png b/pivot_conditional_formatting/static/description/assets/screenshots/ss7.png new file mode 100644 index 000000000..e1d491468 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/ss7.png differ diff --git a/pivot_conditional_formatting/static/description/banner.png b/pivot_conditional_formatting/static/description/banner.png new file mode 100644 index 000000000..77d4ead70 Binary files /dev/null and b/pivot_conditional_formatting/static/description/banner.png differ diff --git a/pivot_conditional_formatting/static/description/icon.png b/pivot_conditional_formatting/static/description/icon.png new file mode 100644 index 000000000..1e65ad5bd Binary files /dev/null and b/pivot_conditional_formatting/static/description/icon.png differ diff --git a/pivot_conditional_formatting/static/description/images/checked.png b/pivot_conditional_formatting/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/pivot_conditional_formatting/static/description/images/checked.png differ diff --git a/pivot_conditional_formatting/static/description/images/cybrosys.png b/pivot_conditional_formatting/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/pivot_conditional_formatting/static/description/images/cybrosys.png differ diff --git a/pivot_conditional_formatting/static/description/index.html b/pivot_conditional_formatting/static/description/index.html new file mode 100644 index 000000000..8c107876d --- /dev/null +++ b/pivot_conditional_formatting/static/description/index.html @@ -0,0 +1,585 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Conditional Formatting in Pivot View

+

+ Conditional Formatting in pivot view according to different rules. +

+ +
+
+ + + +
+
+

+ Overview +

+
+ +
+

+ This module helps to setup predefined rules for conditional + formatting in pivot view for specific models.

+ +
+
+ +
+
+

+ Features +

+
+ +
+
+ +
+
+

Community & Enterprise support.

+
+
+ +
+
+ +
+
+

+ Showcase difference between cells, according to the + rules. +

+
+
+
+
+ +
+
+

+ Predefinable default rules for specific models and + views. +

+
+
+
+
+ +
+
+

+ Select cells and add rules dynamically. +

+
+
+ +
+
+ +
+
+

+ Define background and text colors for the cells. +

+
+
+ + +
+ +
+
+

+ Screenshots +

+
+ +
+

+ Enable option for setting conditional rules on pivot views +

+

+ Go to Settings -> Users & Companies -> Users -> + under "Technical" section in your user, enable "Allow to + Set Pivot Conditional Rules option". +

+ +
+
+

+ Setup default rules for models +

+

+ Go to Settings -> Pivot Settings -> Create new rules in this + menu. Choose the Model and its Pivot View, then establish the + Rules in the table below based on different rule Conditions. + Set the Value, Background color for the cells and Text + color for the cells. +

+ + +
+
+

+ Setup rules from the pivot view +

+

+ When you go to a pivot view with Default Rules, + You will see the changes in the pivot according to the Default Rules. + Drag along the pivot cells to select the cells you want to apply + the rules on. +

+ + +
+
+

+ Click on the Conditional Formatting button for setting the Rule, + then select the Condition and enter the Value to base the condition + on, choose the Background color and Text color and click the Save + button to apply the rule. +

+ + +
+ +
+ + + +
+
+ +
+

+ Related Products +

+
+
+
+ +
+
+ + + + +
+
+
+

Our Services

+
+
+ +
+
+ +
+
+ Odoo Customization +
+
+ +
+
+ +
+
+ Odoo Implementation +
+
+ +
+
+ +
+
+ Odoo Support +
+
+ +
+
+ +
+
+ Hire Odoo Developer +
+
+ +
+
+ +
+
+ Odoo Integration +
+
+ +
+
+ +
+
+ Odoo Migration +
+
+ + +
+
+ +
+
+ Odoo Consultancy +
+
+ +
+
+ +
+
+ Odoo Implementation +
+
+ +
+
+ +
+
+ Odoo Licensing Consultancy +
+
+
+
+ + +
+
+
+

Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure and sell your products +

+
+
+ +
+
+ +
+ POS +
+

+ Easy configuration and convivial experience +

+
+
+ +
+
+ +
+ Education +
+

+ A platform for educational management +

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and schedule your operations +

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile friendly, awe-inspiring product pages +

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of services and invoice +

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or restaurant methodically +

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An all-inclusive hotel management application +

+
+
+ +
+
+ + + +
+
+
+

Need Help?

+
+
+
+ + + +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+
diff --git a/pivot_conditional_formatting/static/src/css/pivot_conditional_formatting.css b/pivot_conditional_formatting/static/src/css/pivot_conditional_formatting.css new file mode 100644 index 000000000..59a5f0360 --- /dev/null +++ b/pivot_conditional_formatting/static/src/css/pivot_conditional_formatting.css @@ -0,0 +1,107 @@ +.selected_cell{ + border: 4px solid red !important; + opacity: 0.75; +} +.prevent-select { + -webkit-user-select: none; /* Safari */ + -ms-user-select: none; /* IE 10 and IE 11 */ + user-select: none; /* Standard syntax */ +} +.conditional_container{ + display: flex; + width: 30vw; + min-height:20vh; + background: #e3eaf0; + position: relative; + padding: 5px; + margin-top: 1vh; + box-shadow: 3px 3px 5px 0px rgb(0 0 0 / 32%); + margin-left: 1vw; + margin-bottom: 1vh; + border-radius: 5px; +} + +.sub_container1{ + height: 100%; + background: #e3eaf0; + display: flex; + justify-content: space-evenly; + align-items: center; + flex-direction: column; + width: 100%; +} + +.condition_select{ + width: 30%; + background: #71639e; + color: black; + font-weight: 500; + margin: 3%; + text-align: center; + padding: 1%; + border-radius: 4px; +} + +.condition_val{ + width: 61%; + height: 29px; + margin: 2%; + border: 2px solid #71639e; + border-radius: 4px; +} + +.condition_button{ + border: none; + background: #8b93d2; + margin: 4% 0; + padding: 1% 6%; + border-radius: 3px; + font-size: 16px; +} +.condition_button:hover{ + background: #5b64ad; +} + +.rule_container{ + background: #e3eaf0; + display: flex; + justify-content: space-between; + align-items: center; + flex-direction: column; + height: 100px; + border: 1px solid black; +} +.input_container{ + display:flex; +} + +.sub_input_container{ + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + color: black; +} +.sub_color_container{ + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + padding: 0px 30px; + color: black; +} +.color_container{ + display: flex; +} + +.color-input{ + width: 34px; + height: 32px; + border: none; + outline: none; +} + +.validation-error{ + display: none; + color: red; +} diff --git a/pivot_conditional_formatting/static/src/js/pivot_conditional_formatting.js b/pivot_conditional_formatting/static/src/js/pivot_conditional_formatting.js new file mode 100644 index 000000000..7134944cf --- /dev/null +++ b/pivot_conditional_formatting/static/src/js/pivot_conditional_formatting.js @@ -0,0 +1,252 @@ +/** @odoo-module **/ + + import { PivotRenderer } from "@web/views/pivot/pivot_renderer"; + import { PivotController } from "@web/views/pivot/pivot_controller"; + import { useService } from "@web/core/utils/hooks"; + import { patch } from '@web/core/utils/patch'; + const { useExternalListener, useEffect } = owl; + + patch(PivotRenderer.prototype,'pivot_render.patch',{ + setup() { + this._super.apply(); + this.orm = useService("orm"); + this.isMouseDown = false; + this.startRowIndex = null; + this.startCellIndex = null; + useExternalListener(document, 'mouseup', this.mouse_up_function) + useEffect(() => { + this.set_default_rules() + }) + }, + + async set_default_rules(){ +// function for default rules to be applied on the pivot table + var self = this + var viewId = this.env.config.viewId + var model = this.env.searchModel.resModel + await this.orm.call("conditional.rules","search_read", [],{ + domain: [['model_id','=',model],['view_id','=',viewId]], + }).then(function(res){ + self.conditional_rules = res + }) + var cells = this.__owl__.bdom.el.querySelectorAll('td') + cells.forEach(function(data){ + data.style.backgroundColor = "#f8f9fa" + data.style.color = "black" + }) + $(this.__owl__.bdom.el.querySelectorAll( + '.o_pivot.table-responsive table')).find( + ".selected_cell").removeClass("selected_cell"); + $(this.__owl__.bdom.parentEl.parentElement).find( + '.conditional_button').css({display:"none"}) + $(this.__owl__.bdom.parentEl.parentElement).find( + '.conditional_container').css({display:"none"}) + + for (let i = 0, len = this.conditional_rules.length; i < len; i++){ + var condition = this.conditional_rules[i].rule + var condition_val = this.conditional_rules[i].value + var second_condition_val = this.conditional_rules[i].second_value + var color_val = this.conditional_rules[i].color + var text_color_val = this.conditional_rules[i].text_color + + for (let j = 0, len = cells.length; j < len; j++){ + var cell_val = cells[j].innerText + if(cell_val){ + cell_val = cell_val.replace(',','') + } + if(condition == 'less_than'){ + if(parseFloat(condition_val)>parseFloat(cell_val)){ + cells[j].classList.remove("bg-100") + cells[j].style.backgroundColor = color_val + cells[j].style.color = text_color_val + } + } + if(condition == "greater_than"){ + if(parseFloat(condition_val)< parseFloat(cell_val)){ + cells[j].classList.remove("bg-100") + cells[j].style.backgroundColor = color_val + cells[j].style.color = text_color_val + } + } + if(condition == "is_empty"){ + if(cells[j].innerText == ""){ + cells[j].classList.remove("bg-100") + cells[j].style.backgroundColor = color_val + cells[j].style.color = text_color_val + } + } + if(condition == "in_between"){ + if(parseFloat(cell_val)> parseFloat(condition_val) && parseFloat(cell_val)< parseFloat(second_condition_val)){ + cells[j].classList.remove("bg-100") + cells[j].style.backgroundColor = color_val + cells[j].style.color = text_color_val + } + } + } + } + }, + conditional_formattoo(e){ + // function for selecting table columns and adding and removing +// classes + if (e.target.localName == 'td' || e.target.className == 'o_value'){ + this.isMouseDown = true; + var cell; + if(e.target.className == 'o_value'){ + cell = e.target.parentElement; + }else{ + cell = e.target + } + $(this.__owl__.bdom.el.querySelectorAll( + '.o_pivot.table-responsive table')).find(".selected_cell" + ).removeClass("selected_cell"); // deselect everything + cell.className = 'selected_cell prevent-select' + this.startCellIndex = cell.cellIndex; + this.startRowIndex = cell.parentElement.cellIndex; + return false; + } + }, + + + mouse_over_function(e){ +// function for selecting table columns + if (!this.isMouseDown) return; + if (e.target.localName == 'td' || e.target.className == 'o_value'){ + var cell = e.target.parentElement; + if(e.target.className == 'o_value'){ + cell = e.target.parentElement; + }else{ + cell = e.target + } + cell.classList.add("selected_cell") + $(this.__owl__.bdom.parentEl.parentElement).find( + '.conditional_button').css({display:'block'}) + } + }, + + mouse_up_function(){ +// function for changing variable value to stop table cell selection + this.isMouseDown = false; + }, + + display_field(){ +// function for hiding and showing input fields inside popup window + var condition = $(this.__owl__.bdom.el.querySelectorAll( + '.condition_select')).val() + if(this.__owl__.bdom.el.querySelectorAll( + '.validation-error')[0].style.display == "inline"){ + this.__owl__.bdom.el.querySelectorAll( + '.validation-error')[0].style.display = "none"; + } + $(this.__owl__.bdom.el.querySelectorAll( + '#condition_val'))[0].value = '' + $(this.__owl__.bdom.el.querySelectorAll( + '#secondcondition_val'))[0].value = '' + if(condition == 'in between'){ + $(this.__owl__.bdom.el.querySelectorAll( + '#secondcondition_val')).css({display:'block'}) + $(this.__owl__.bdom.el.querySelectorAll( + '#value_label')).css({display:'block'}) + $(this.__owl__.bdom.el.querySelectorAll( + '#sub_input_container2')).css({display:'flex'}) + }else{ + $(this.__owl__.bdom.el.querySelectorAll( + '#secondcondition_val')).css({display:'none'}) + $(this.__owl__.bdom.el.querySelectorAll( + '#value_label')).css({display:'none'}) + $(this.__owl__.bdom.el.querySelectorAll( + '#sub_input_container2')).css({display:'none'}) + } + if(condition === 'null'){ + $(this.__owl__.bdom.el.querySelectorAll( + '#condition_val')).css({display:'none'}) + + $(this.__owl__.bdom.el.querySelectorAll( + '#value_label1')).css({display:'none'}) + $(this.__owl__.bdom.el.querySelectorAll( + '#sub_input_container1')).css({display:'none'}) + }else{ + $(this.__owl__.bdom.el.querySelectorAll( + '#condition_val')).css({display:'block'}) + $(this.__owl__.bdom.el.querySelectorAll( + '#value_label1')).css({display:'block'}) + $(this.__owl__.bdom.el.querySelectorAll( + '#sub_input_container1')).css({display:'flex'}) + } + }, + set_rule(){ +// function for applying rules through popup window + var condition = $(this.__owl__.bdom.el.querySelectorAll( + '.condition_select')).val() + var color_val = $(this.__owl__.bdom.el.querySelectorAll( + '.colorpicker')).val() + var text_color_val = $(this.__owl__.bdom.el.querySelectorAll( + '.text_color')).val() + var cells = $(this.__owl__.bdom.el.querySelectorAll( + '.selected_cell')) + var condition_val = $(this.__owl__.bdom.el.querySelectorAll( + '#condition_val')).val() + var second_condition_val = $(this.__owl__.bdom.el.querySelectorAll( + '#secondcondition_val')).val() + this.__owl__.bdom.el.querySelectorAll( + '#condition_val')[0].value = '' + this.__owl__.bdom.el.querySelectorAll( + '#secondcondition_val')[0].value = '' + if(condition == 'in between'){ + if(condition_val > second_condition_val){ + $(this.__owl__.bdom.el.querySelectorAll( + '.validation-error')).css({display:'inline'}) + return + } + } + for (let i = 0, len = cells.length; i < len; i++){ + var cell_val = cells[i].innerText + if(cell_val){ + cell_val = cell_val.replace(',','') + } + if(condition == 'less than'){ + if(parseFloat(condition_val)>parseFloat(cell_val)){ + cells[i].classList.remove("bg-100") + cells[i].style.backgroundColor = color_val + cells[i].style.color = text_color_val + } + } + if(condition == 'greater than'){ + if(parseFloat(condition_val)< parseFloat(cell_val)){ + cells[i].classList.remove("bg-100") + cells[i].style.backgroundColor = color_val + cells[i].style.color = text_color_val + } + } + if(condition == "null"){ + if(cells[i].innerText == ""){ + cells[i].classList.remove("bg-100") + cells[i].classList.remove("bg-100") + cells[i].style.backgroundColor = color_val + cells[i].style.color = text_color_val + } + } + if(condition == 'in between'){ + if(parseFloat(cell_val)> parseFloat(condition_val) && parseFloat(cell_val)< parseFloat(second_condition_val)){ + cells[i].classList.remove("bg-100") + cells[i].style.backgroundColor = color_val + cells[i].style.color = text_color_val + } + } + } + }, + + }); + patch(PivotController.prototype, 'PivotController.Patch', { + conditional_format_tab(){ +// This function is called to display the conditional formatting +// window/wizard in the UI. + $(this.__owl__.bdom.el.querySelectorAll(".conditional_container")).css({display:"block"}) + this.__owl__.bdom.el.querySelectorAll("#condition_val")[0].value = '' + this.__owl__.bdom.el.querySelectorAll("#secondcondition_val")[0].value = '' + if(this.__owl__.bdom.el.querySelectorAll( + '.validation-error')[0].style.display == "inline"){ + this.__owl__.bdom.el.querySelectorAll( + '.validation-error')[0].style.display = "none"; + } + }, + }); diff --git a/pivot_conditional_formatting/static/src/xml/pivot_conditional_formatting.xml b/pivot_conditional_formatting/static/src/xml/pivot_conditional_formatting.xml new file mode 100644 index 000000000..5a3dc31f1 --- /dev/null +++ b/pivot_conditional_formatting/static/src/xml/pivot_conditional_formatting.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + conditional_formattoo + mouse_over_function + + + + + + + + + + diff --git a/pivot_conditional_formatting/views/pivot_conditional_settings_views.xml b/pivot_conditional_formatting/views/pivot_conditional_settings_views.xml new file mode 100644 index 000000000..c1b08f9c5 --- /dev/null +++ b/pivot_conditional_formatting/views/pivot_conditional_settings_views.xml @@ -0,0 +1,101 @@ + + + + + + conditional.rules.view.form + conditional.rules + +
+ + + + + + + + + +
+
+
+ + + + conditional.rule.view.tree + conditional.rules + + + + + + + + + + + + + + pivot.conditional.settings.view.tree + pivot.conditional.settings + + + + + + + + + + + pivot.conditional.settings.view.form + pivot.conditional.settings + +
+ + + + + + + + + + + + + + + +
+
+
+ + + + Pivot Conditional Settings Action + pivot.conditional.settings + tree,form + + + + + +