diff --git a/pivot_conditional_formatting/README.rst b/pivot_conditional_formatting/README.rst new file mode 100644 index 000000000..086ac8692 --- /dev/null +++ b/pivot_conditional_formatting/README.rst @@ -0,0 +1,50 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://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). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developers: (V18) Manasa T P + (V17) Shikhil Raj + +* 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..ab18f6648 --- /dev/null +++ b/pivot_conditional_formatting/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-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 . +# +############################################################################# +from . import models diff --git a/pivot_conditional_formatting/__manifest__.py b/pivot_conditional_formatting/__manifest__.py new file mode 100644 index 000000000..d270ef5e1 --- /dev/null +++ b/pivot_conditional_formatting/__manifest__.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-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 . +# +############################################################################# +{ + "name": "Conditional Formatting in Pivot View", + "version": "18.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.jpg"], + "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..db5e18a55 --- /dev/null +++ b/pivot_conditional_formatting/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 26.06.2025 +#### Version 18.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..aab2fe2d2 --- /dev/null +++ b/pivot_conditional_formatting/models/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-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 conditional_rules +from . import pivot_conditional_settings diff --git a/pivot_conditional_formatting/models/conditional_rules.py b/pivot_conditional_formatting/models/conditional_rules.py new file mode 100644 index 000000000..10873308a --- /dev/null +++ b/pivot_conditional_formatting/models/conditional_rules.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-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 . +# +############################################################################# +from odoo import fields, models + + +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 " + "'In Between' 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', + string="Model", help="Model related to the rule") + view_id = fields.Many2one('ir.ui.view', + related='conditional_id.view_id', string="View", + help="View related to the rule") + conditional_id = fields.Many2one('pivot.conditional.settings', + string="Condition", + help="Pivot Condition setting related to " + "the rule") + company_id = fields.Many2one('res.company', string='Company', + default=lambda self: self.env.company, + help="Company ID related to the rule") 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..e83ea4e11 --- /dev/null +++ b/pivot_conditional_formatting/models/pivot_conditional_settings.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-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', string="Model", + help="The model to set the rules for") + view_id = fields.Many2one('ir.ui.view', string="View", + help="Pivot view of the model") + rules_ids = fields.One2many('conditional.rules', + 'conditional_id', string="Rules", + help="List View Showing details of different rules") + company_id = fields.Many2one('res.company', string='Company', + default=lambda self: self.env.company, + help="Company id related to the Pivot " + "Condition setting") + view_id_domain = fields.Binary(string="View Domain", + compute="_compute_view_id_domain") + + + @api.depends('model_id') + def _compute_view_id_domain(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 + """ + for rec in self: + rec.view_id_domain = [('model', '=', rec.model_id.model), + ('type', '=', 'pivot')] 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/cybro-icon.png b/pivot_conditional_formatting/static/description/assets/cybro-icon.png new file mode 100755 index 000000000..06e73e11d Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/cybro-icon.png differ diff --git a/pivot_conditional_formatting/static/description/assets/cybro-odoo.png b/pivot_conditional_formatting/static/description/assets/cybro-odoo.png new file mode 100755 index 000000000..ed02e07a4 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/cybro-odoo.png differ diff --git a/pivot_conditional_formatting/static/description/assets/h2.png b/pivot_conditional_formatting/static/description/assets/h2.png new file mode 100755 index 000000000..0bfc4707d Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/h2.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/arrows-repeat.svg b/pivot_conditional_formatting/static/description/assets/icons/arrows-repeat.svg new file mode 100755 index 000000000..1d7efabc5 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/arrows-repeat.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/banner-1.png b/pivot_conditional_formatting/static/description/assets/icons/banner-1.png new file mode 100755 index 000000000..c180db172 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/banner-1.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/banner-2.svg b/pivot_conditional_formatting/static/description/assets/icons/banner-2.svg new file mode 100755 index 000000000..e606d97d9 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/banner-2.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/banner-bg.png b/pivot_conditional_formatting/static/description/assets/icons/banner-bg.png new file mode 100755 index 000000000..a8238d3c0 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/banner-bg.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/banner-bg.svg b/pivot_conditional_formatting/static/description/assets/icons/banner-bg.svg new file mode 100755 index 000000000..b1378103e --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/banner-bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/banner-call.svg b/pivot_conditional_formatting/static/description/assets/icons/banner-call.svg new file mode 100755 index 000000000..96c687e81 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/banner-call.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/banner-mail.svg b/pivot_conditional_formatting/static/description/assets/icons/banner-mail.svg new file mode 100755 index 000000000..cbf0d158d --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/banner-mail.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/banner-pattern.svg b/pivot_conditional_formatting/static/description/assets/icons/banner-pattern.svg new file mode 100755 index 000000000..9c1c7e101 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/banner-pattern.svg @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/banner-promo.svg b/pivot_conditional_formatting/static/description/assets/icons/banner-promo.svg new file mode 100755 index 000000000..d52791b11 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/banner-promo.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/brand-pair.svg b/pivot_conditional_formatting/static/description/assets/icons/brand-pair.svg new file mode 100755 index 000000000..d8db7fc1e --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/brand-pair.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 100755 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 100755 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/close-icon.svg b/pivot_conditional_formatting/static/description/assets/icons/close-icon.svg new file mode 100755 index 000000000..df8cce37a --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/close-icon.svg @@ -0,0 +1,5 @@ + + + + + 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 100755 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/collabarate-icon.svg b/pivot_conditional_formatting/static/description/assets/icons/collabarate-icon.svg new file mode 100755 index 000000000..dd4e10518 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/collabarate-icon.svg @@ -0,0 +1,3 @@ + + + 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 100755 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/cybro-logo.png b/pivot_conditional_formatting/static/description/assets/icons/cybro-logo.png new file mode 100755 index 000000000..ff4b78220 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/cybro-logo.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/down.svg b/pivot_conditional_formatting/static/description/assets/icons/down.svg new file mode 100755 index 000000000..f21c36271 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file 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 100755 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 100755 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/faq.png b/pivot_conditional_formatting/static/description/assets/icons/faq.png new file mode 100755 index 000000000..4250b5b81 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/faq.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/feature-icon.svg b/pivot_conditional_formatting/static/description/assets/icons/feature-icon.svg new file mode 100755 index 000000000..fa0ea6850 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/feature-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/feature.png b/pivot_conditional_formatting/static/description/assets/icons/feature.png new file mode 100755 index 000000000..ac7a785c0 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/feature.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/gear.svg b/pivot_conditional_formatting/static/description/assets/icons/gear.svg new file mode 100755 index 000000000..0cc66b6ea --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/gear.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/hero.gif b/pivot_conditional_formatting/static/description/assets/icons/hero.gif new file mode 100644 index 000000000..798ed7142 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/hero.gif differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/hire-odoo.svg b/pivot_conditional_formatting/static/description/assets/icons/hire-odoo.svg new file mode 100755 index 000000000..e1ac089b0 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/hire-odoo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + 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 100755 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 100755 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/life-ring-icon.svg b/pivot_conditional_formatting/static/description/assets/icons/life-ring-icon.svg new file mode 100755 index 000000000..3ae6e1d89 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/life-ring-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + 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 100755 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/mail.svg b/pivot_conditional_formatting/static/description/assets/icons/mail.svg new file mode 100755 index 000000000..1eedde695 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/mail.svg @@ -0,0 +1,3 @@ + + + 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 100755 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/notes.png b/pivot_conditional_formatting/static/description/assets/icons/notes.png new file mode 100755 index 000000000..ee5e95404 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/notes.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/notification icon.svg b/pivot_conditional_formatting/static/description/assets/icons/notification icon.svg new file mode 100755 index 000000000..053189973 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/notification icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/odoo-consultancy.svg b/pivot_conditional_formatting/static/description/assets/icons/odoo-consultancy.svg new file mode 100755 index 000000000..e05f65bde --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/odoo-consultancy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/odoo-licencing.svg b/pivot_conditional_formatting/static/description/assets/icons/odoo-licencing.svg new file mode 100755 index 000000000..2606c88b0 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/odoo-licencing.svg @@ -0,0 +1,3 @@ + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/odoo-logo.png b/pivot_conditional_formatting/static/description/assets/icons/odoo-logo.png new file mode 100755 index 000000000..0e4d0eb5a Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/odoo-logo.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/patter.svg b/pivot_conditional_formatting/static/description/assets/icons/patter.svg new file mode 100755 index 000000000..25c9c0a8f --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/patter.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/pattern1.png b/pivot_conditional_formatting/static/description/assets/icons/pattern1.png new file mode 100755 index 000000000..09ab0fb2d Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/pattern1.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 100755 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-piece-icon.svg b/pivot_conditional_formatting/static/description/assets/icons/puzzle-piece-icon.svg new file mode 100755 index 000000000..3e9ad9373 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/puzzle-piece-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + 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 100755 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/replace-icon.svg b/pivot_conditional_formatting/static/description/assets/icons/replace-icon.svg new file mode 100755 index 000000000..d0e3a7af1 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/replace-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + 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 100755 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/screenshot-main.png b/pivot_conditional_formatting/static/description/assets/icons/screenshot-main.png new file mode 100755 index 000000000..575f8e676 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/screenshot-main.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/screenshot.png b/pivot_conditional_formatting/static/description/assets/icons/screenshot.png new file mode 100755 index 000000000..cef272529 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/screenshot.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 100755 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/skype-fill.svg b/pivot_conditional_formatting/static/description/assets/icons/skype-fill.svg new file mode 100755 index 000000000..c17423639 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/skype-fill.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/skype.png b/pivot_conditional_formatting/static/description/assets/icons/skype.png new file mode 100755 index 000000000..51b409fb3 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/skype.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/skype.svg b/pivot_conditional_formatting/static/description/assets/icons/skype.svg new file mode 100755 index 000000000..df3dad39b --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/skype.svg @@ -0,0 +1,3 @@ + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/star-1.svg b/pivot_conditional_formatting/static/description/assets/icons/star-1.svg new file mode 100755 index 000000000..7e55ab162 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/star-1.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/star-2.svg b/pivot_conditional_formatting/static/description/assets/icons/star-2.svg new file mode 100755 index 000000000..5ae9f507a --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/star-2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/pivot_conditional_formatting/static/description/assets/icons/support.png b/pivot_conditional_formatting/static/description/assets/icons/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/support.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/test-1 - Copy.png b/pivot_conditional_formatting/static/description/assets/icons/test-1 - Copy.png new file mode 100755 index 000000000..f6a902663 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/test-1 - Copy.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/test-1.png b/pivot_conditional_formatting/static/description/assets/icons/test-1.png new file mode 100755 index 000000000..0908add2b Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/test-1.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/test-2.png b/pivot_conditional_formatting/static/description/assets/icons/test-2.png new file mode 100755 index 000000000..4671fe91e Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/test-2.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 100755 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 100755 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/translate.svg b/pivot_conditional_formatting/static/description/assets/icons/translate.svg new file mode 100755 index 000000000..af9c8a1aa --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + + 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 100755 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 100755 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/video.png b/pivot_conditional_formatting/static/description/assets/icons/video.png new file mode 100755 index 000000000..576705b17 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/video.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/whatsapp.png b/pivot_conditional_formatting/static/description/assets/icons/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/icons/whatsapp.png differ diff --git a/pivot_conditional_formatting/static/description/assets/icons/wrench-icon.svg b/pivot_conditional_formatting/static/description/assets/icons/wrench-icon.svg new file mode 100755 index 000000000..174b5a465 --- /dev/null +++ b/pivot_conditional_formatting/static/description/assets/icons/wrench-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + 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 100755 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/modules/1.jpg b/pivot_conditional_formatting/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..3cb15fe01 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/1.jpg differ diff --git a/pivot_conditional_formatting/static/description/assets/modules/2.jpg b/pivot_conditional_formatting/static/description/assets/modules/2.jpg new file mode 100644 index 000000000..662cadcc3 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/2.jpg differ diff --git a/pivot_conditional_formatting/static/description/assets/modules/3.jpg b/pivot_conditional_formatting/static/description/assets/modules/3.jpg new file mode 100644 index 000000000..717a00443 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/3.jpg 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..00ebf54ad 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.jpg b/pivot_conditional_formatting/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..7c67e2eec Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/5.jpg differ diff --git a/pivot_conditional_formatting/static/description/assets/modules/6.gif b/pivot_conditional_formatting/static/description/assets/modules/6.gif new file mode 100644 index 000000000..a35ece8df Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/modules/6.gif differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/1.png b/pivot_conditional_formatting/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..9c653cfd7 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/1.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/2.png b/pivot_conditional_formatting/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..45718c275 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/2.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/3.png b/pivot_conditional_formatting/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..2eff095ca Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/3.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/4.png b/pivot_conditional_formatting/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..d8ac1a693 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/4.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/5.png b/pivot_conditional_formatting/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..6c4ce79af Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/5.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/6.png b/pivot_conditional_formatting/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..1a3194e8c Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/6.png differ diff --git a/pivot_conditional_formatting/static/description/assets/screenshots/7.png b/pivot_conditional_formatting/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..5f854709e Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/screenshots/7.png differ diff --git a/pivot_conditional_formatting/static/description/assets/y18.jpg b/pivot_conditional_formatting/static/description/assets/y18.jpg new file mode 100755 index 000000000..eea1714f2 Binary files /dev/null and b/pivot_conditional_formatting/static/description/assets/y18.jpg differ diff --git a/pivot_conditional_formatting/static/description/banner.jpg b/pivot_conditional_formatting/static/description/banner.jpg new file mode 100644 index 000000000..86483df60 Binary files /dev/null and b/pivot_conditional_formatting/static/description/banner.jpg 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..349ea993c Binary files /dev/null and b/pivot_conditional_formatting/static/description/icon.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..af909464b --- /dev/null +++ b/pivot_conditional_formatting/static/description/index.html @@ -0,0 +1,1090 @@ + + + + + + Conditional Formatting in Pivot View + + + + + + + + + + +
+
+ + + +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+
+

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

+

Conditional Formatting in Pivot View +

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

Key + Highlights

+
+
+
+
+ +
+
+ Conditional Formatting in Pivot Views +
+

+ Allows you to visually highlight and + differentiate cells based on values using + color rules in pivot tables.

+
+
+
+
+
+ +
+
+ Predefined Default Rules +
+

+ Can predefine formatting rules specific to a + model and view. +

+
+
+
+
+ +
+
+
+ Conditional Formatting in Pivot View +

+ Are you ready to make your business more + organized? +
Improve now! +

+ +
+
+ +
+
+
+ + + + +
+
+ +
+
+
+
+ acc_bg +
+ +
+
+
+
+

+ 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". +

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

+ Pivot Settings Menu + + +

+
+
+

+ Open the Pivot Setting menu. +

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

+ + Setup rules for 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. +

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

+ Open Pivot View + + +

+
+
+

+ Open the pivot view of + quotation. Drag along the pivot + cells to select the cells you + want to apply the rules on. +

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

+ Conditional Formatting Button + +

+
+
+

+ 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. +

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

+ Set Conditions + +

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

+ Conditions Applied to Pivot Table + +

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

+ Compatible with Both Community & Enterprise Editions +

+
+ +
+
+
+
+
+
+ +
+

+ Predefined Default Rules +

+
+
+
+
+
+
+
+ +
+

+ Makes large pivot tables more readable and actionable.

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

+ It allows you to + apply conditional + formatting rules to + cells in pivot + views, helping you + visually analyze + data by highlighting + values based on + conditions.

+
+
+ +
+ +
+

+ Yes. You can + predefine default + formatting rules for + specific models, so + users get + consistent visual + feedback across the + system. +

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

+ Latest Release 18.0.1.0.0 +

+ + 26th June, 2025 + +
+
+
+
+
+ Add +
+
+
+
    +
  • + Initial Commit +
  • + +
+
+
+
+
+
+
+
+
+
+ + + +
+

+ Related Products +

+ +
+ + +
+

+ Our Services

+ +
+
+ +
+
+ .... +
+
+ +
+ + +
+
+ + + + + + 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..487c20d53 --- /dev/null +++ b/pivot_conditional_formatting/static/src/js/pivot_conditional_formatting.js @@ -0,0 +1,248 @@ +/** @odoo-module **/ +import { PivotRenderer } from "@web/views/pivot/pivot_renderer"; +import { useService } from "@web/core/utils/hooks"; +import { patch } from '@web/core/utils/patch'; +import { useExternalListener, useEffect } from "@odoo/owl"; + +patch(PivotRenderer.prototype,{ + setup() { + super.setup(); + 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.parentEl.querySelectorAll('td') + cells.forEach(function(data){ + data.style.backgroundColor = "#f8f9fa" + data.style.color = "black" + }) + this.__owl__.bdom.parentEl.querySelectorAll('.o_pivot.table-responsive table .selected_cell').forEach(cell => { + cell.classList.remove('selected_cell')}); + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('.conditional_button').forEach(el => { + el.style.display = "none"}); + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('.conditional_container').forEach(el => { + el.style.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 + } + } + } + } + }, + async conditional_format_tab(){ +// This function is called to display the conditional formatting +// window/wizard in the UI. + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('.conditional_container').forEach(el => { + el.style.display = "block"; + }); + this.__owl__.bdom.parentEl.querySelectorAll("#condition_val")[0].value = '' + this.__owl__.bdom.parentEl.querySelectorAll("#secondcondition_val")[0].value = '' + if(this.__owl__.bdom.parentEl.querySelectorAll( + '.validation-error')[0].style.display == "inline"){ + this.__owl__.bdom.parentEl.querySelectorAll( + '.validation-error')[0].style.display = "none"; + } + }, + + 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.parentEl.querySelectorAll('.o_pivot.table-responsive table .selected_cell').forEach(cell => { + cell.classList.remove('selected_cell'); + }); + 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.querySelectorAll('.conditional_button').forEach(el => { + el.style.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.parentEl.querySelectorAll( + '.condition_select')[0].value + if(this.__owl__.bdom.parentEl.querySelectorAll( + '.validation-error')[0].style.display == "inline"){ + this.__owl__.bdom.parentEl.querySelectorAll( + '.validation-error')[0].style.display = "none"; + } + this.__owl__.bdom.parentEl.querySelectorAll( + '#condition_val')[0].value = '' + this.__owl__.bdom.parentEl.querySelectorAll( + '#secondcondition_val')[0].value = '' + if(condition == 'in between'){ + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#secondcondition_val').forEach(el => { + el.style.display = "block"}); + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#value_label').forEach(el => { + el.style.display = "block"}); + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#sub_input_container2').forEach(el => { + el.style.display = "flex"}); + }else{ + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#secondcondition_val').forEach(el => { + el.style.display = "none"}); + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#value_label').forEach(el => { + el.style.display = "none"}); + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#sub_input_container2').forEach(el => { + el.style.display = "none"}); + } + if(condition === 'null'){ + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#condition_val').forEach(el => { + el.style.display = "none"}); + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#value_label1').forEach(el => { + el.style.display = "none"}); + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#sub_input_container1').forEach(el => { + el.style.display = "none"}); + }else{ + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#condition_val').forEach(el => { + el.style.display = "block"}); + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#value_label1').forEach(el => { + el.style.display = "block"}); + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('#sub_input_container1').forEach(el => { + el.style.display = "flex"}); + } + }, + set_rule(){ +// function for applying rules through popup window + var condition = this.__owl__.bdom.parentEl.querySelectorAll( + '.condition_select')[0].value + var color_val = this.__owl__.bdom.parentEl.querySelectorAll( + '.colorpicker')[0].value + var text_color_val = this.__owl__.bdom.parentEl.querySelectorAll( + '.text_color')[0].value + var cells = this.__owl__.bdom.parentEl.querySelectorAll( + '.selected_cell') + var condition_val = this.__owl__.bdom.parentEl.querySelectorAll( + '#condition_val')[0].value + var second_condition_val = this.__owl__.bdom.parentEl.querySelectorAll( + '#secondcondition_val')[0].value + this.__owl__.bdom.parentEl.querySelectorAll( + '#condition_val')[0].value = '' + this.__owl__.bdom.parentEl.querySelectorAll( + '#secondcondition_val')[0].value = '' + if(condition == 'in between'){ + if(condition_val > second_condition_val){ + this.__owl__.bdom.parentEl.parentElement.querySelectorAll('.validation-error').forEach(el => { + el.style.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 + } + } + } + }, + }); \ No newline at end of file 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..969f3deca --- /dev/null +++ b/pivot_conditional_formatting/views/pivot_conditional_settings_views.xml @@ -0,0 +1,103 @@ + + + + + + conditional.rules.view.form + conditional.rules + +
+ + + + + + + + + +
+
+
+ + + + conditional.rule.view.list + conditional.rules + + + + + + + + + + + + + + pivot.conditional.settings.view.list + pivot.conditional.settings + + + + + + + + + + + pivot.conditional.settings.view.form + pivot.conditional.settings + +
+ + + + + + + + + + + + + + + + +
+
+
+ + + + Pivot Conditional Settings Action + pivot.conditional.settings + list,form + + + + + +