diff --git a/odoo_dynamic_dashboard/README.rst b/odoo_dynamic_dashboard/README.rst new file mode 100755 index 000000000..cf23cfbbb --- /dev/null +++ b/odoo_dynamic_dashboard/README.rst @@ -0,0 +1,49 @@ +.. 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 + +Odoo Dynamic Dashboard +====================== +* Dynamically Arrange the dashboard to get the information that are relevant to your business, department, or a specific process or need. + +Configuration +============= +* No additional configurations needed. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Affero General Public License, Version 3 (AGPL-3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developers : Irfan, Afras, + (V16) Amal Prasad, + (V17) Arjun S, +* 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/odoo_dynamic_dashboard/__init__.py b/odoo_dynamic_dashboard/__init__.py new file mode 100644 index 000000000..57ce4b1c1 --- /dev/null +++ b/odoo_dynamic_dashboard/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models +from . import controllers diff --git a/odoo_dynamic_dashboard/__manifest__.py b/odoo_dynamic_dashboard/__manifest__.py new file mode 100644 index 000000000..c2b74b148 --- /dev/null +++ b/odoo_dynamic_dashboard/__manifest__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': "Odoo Dynamic Dashboard", + 'version': '17.0.1.0.0', + 'category': 'Extra Tools ', + 'summary': """Create Configurable Dashboards Easily""", + 'description': """Create Configurable Dashboard Dynamically to get the + information that are relevant to your business, department, + or a specific process or need, Dynamic Dashboard, Dashboard , + Dashboard Odoo""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['web'], + 'data': [ + 'security/ir.model.access.csv', + 'views/dashboard_view.xml', + 'views/dashboard_menu_view.xml', + 'views/dynamic_block_view.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'odoo_dynamic_dashboard/static/src/js/**/*.js', + 'odoo_dynamic_dashboard/static/src/scss/**/*.scss', + 'odoo_dynamic_dashboard/static/src/xml/**/*.xml', + ], + }, + 'images': ['static/description/banner.png'], + 'license': "AGPL-3", + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/odoo_dynamic_dashboard/controllers/__init__.py b/odoo_dynamic_dashboard/controllers/__init__.py new file mode 100644 index 000000000..ccb27dab2 --- /dev/null +++ b/odoo_dynamic_dashboard/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import odoo_dynamic_dashboard diff --git a/odoo_dynamic_dashboard/controllers/odoo_dynamic_dashboard.py b/odoo_dynamic_dashboard/controllers/odoo_dynamic_dashboard.py new file mode 100644 index 000000000..8a5336761 --- /dev/null +++ b/odoo_dynamic_dashboard/controllers/odoo_dynamic_dashboard.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import http +from odoo.http import request + + +class DynamicDashboard(http.Controller): + """ + This is the class DynamicDashboard which is the subclass of the class + http.Controller + """ + + @http.route('/create/tile', type='json', auth='user') + def tile_creation(self, **kw): + """This is the method to create the tile when create on the button + ADD BLOCK""" + tile_type = kw.get('type') + action_id = kw.get('action_id') + request.env['dashboard.block'].get_dashboard_vals(action_id) + tile_id = request.env['dashboard.block'].sudo().create({ + 'name': 'New Block', + 'type': tile_type, + 'tile_color': '#1f6abb', + 'text_color': '#FFFFFF', + 'fa_icon': 'fa fa-money', + 'fa_color': '#132e45', + 'edit_mode': True, + 'client_action': int(action_id), + }) + return {'id': tile_id.id, 'name': tile_id.name, 'type': tile_type, 'icon': 'fa fa-money', + 'color': '#1f6abb', + 'tile_color': '#1f6abb', + 'text_color': '#FFFFFF', + 'icon_color': '#1f6abb'} + + @http.route('/get/values', type='json', auth='user') + def get_value(self, **kw): + """This is the method get_value which will get the records inside the + tile""" + action_id = kw.get('action_id') + datas = request.env['dashboard.block'].get_dashboard_vals(action_id) + return datas diff --git a/odoo_dynamic_dashboard/doc/RELEASE_NOTES.md b/odoo_dynamic_dashboard/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..c402d045b --- /dev/null +++ b/odoo_dynamic_dashboard/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 02.03.2024 +#### Version 17.0.1.0.0 +#### ADD + +- Initial Commit for Odoo Dynamic Dashboard diff --git a/odoo_dynamic_dashboard/models/__init__.py b/odoo_dynamic_dashboard/models/__init__.py new file mode 100644 index 000000000..e87ef0c37 --- /dev/null +++ b/odoo_dynamic_dashboard/models/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import dashboard_block +from . import dashboard_block_line +from . import dashboard_menu +from . import domain_to_sql diff --git a/odoo_dynamic_dashboard/models/dashboard_block.py b/odoo_dynamic_dashboard/models/dashboard_block.py new file mode 100644 index 000000000..3a0656e82 --- /dev/null +++ b/odoo_dynamic_dashboard/models/dashboard_block.py @@ -0,0 +1,151 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import models, fields, _ +from odoo.exceptions import ValidationError +from odoo.osv import expression +from ast import literal_eval + + +class DashboardBlock(models.Model): + """Creates the model Dashboard Blocks""" + _name = "dashboard.block" + _description = "Dashboard Blocks" + + def get_default_action(self): + """This is the method get_default_action which will return the default + action id.""" + action_id = self.env.ref( + 'odoo_dynamic_dashboard.dynamic_dashboard_action') + if action_id: + return action_id.id + return False + + name = fields.Char(string="Name", help='Name of the block') + field_id = fields.Many2one('ir.model.fields', string='Measured Field', + domain="[('store', '=', True), ('model_id', '=', model_id), ('ttype', 'in', ['float','integer','monetary'])]", + help='Measured field for the block') + fa_icon = fields.Char(string="Icon", help='Icon for the block') + graph_size = fields.Selection( + selection=[("col-lg-4", "Small"), ("col-lg-6", "Medium"), + ("col-lg-12", "Large")], + string="Graph Size", default='col-lg-4', help="Size of the graph") + operation = fields.Selection( + selection=[("sum", "Sum"), ("avg", "Average"), ("count", "Count")], + string="Operation", + help='Tile Operation that needs to bring values for tile') + graph_type = fields.Selection( + selection=[("bar", "Bar"), ("radar", "Radar"), ("pie", "Pie"), + ("line", "Line"), ("doughnut", "Doughnut")], + string="Chart Type", help='Type of Chart') + measured_field = fields.Many2one("ir.model.fields", string="Measured Field", + help='Measure field for the chart') + client_action = fields.Many2one('ir.actions.client', + default=get_default_action, + string="Client Action", + help='Client Action for the dashboard ' + 'block') + type = fields.Selection( + selection=[("graph", "Chart"), ("tile", "Tile")], string="Type", + help='Type of Block ie, Chart or Tile') + x_axis = fields.Char(string="X-Axis", help="X-axis for the chart") + y_axis = fields.Char(string="Y-Axis", help="Y-axis for the chart") + group_by = fields.Many2one("ir.model.fields", store=True, + string="Group by(Y-Axis)", + help='Field value for Y-Axis', + domain="[('store', '=', True)]") + tile_color = fields.Char(string="Tile Color", help='Primary Color of Tile') + text_color = fields.Char(string="Text Color", help='Text Color of Tile') + fa_color = fields.Char(string="Icon Color", help='Icon Color of Tile') + filter = fields.Char(string="Filter", help='Filter for Tile') + model_id = fields.Many2one('ir.model', string='Model', + help='Model for Tile') + model_name = fields.Char(related='model_id.model', readonly=True, + string="Model Name", help='Model Name of Tile') + filter_by = fields.Many2one("ir.model.fields", string=" Filter By", + help="Filter By for Tile") + filter_values = fields.Char(string="Filter Values", + help="Filter Values for tiles accordingly") + sequence = fields.Integer(string="Sequence", + help="sequence of the dashboard") + edit_mode = fields.Boolean(default=False, invisible=True, + string="Edit Mode", help="Edit mode of the tile") + + def get_dashboard_vals(self, action_id): + """Dashboard block values""" + block_id = [] + for rec in self.env['dashboard.block'].sudo().search( + [('client_action', '=', int(action_id))]): + vals = { + 'id': rec.id, + 'name': rec.name, + 'type': rec.type, + 'graph_type': rec.graph_type, + 'icon': rec.fa_icon, + 'cols': rec.graph_size, + 'color': rec.tile_color if rec.tile_color else '#1f6abb;', + 'text_color': rec.text_color if rec.text_color else '#FFFFFF;', + 'icon_color': rec.fa_color if rec.fa_color else '#1f6abb;', + 'tile_color': rec.tile_color if rec.tile_color else '#FFFFFF;', + 'model_name': rec.model_name, + 'measured_field': rec.measured_field.field_description if rec.measured_field else None, + 'y_field': rec.measured_field.name, + 'x_field': rec.group_by.name, + 'operation': rec.operation + } + domain = [] + if rec.filter: + domain = expression.AND([literal_eval(rec.filter)]) + if rec.model_name: + if rec.type == 'graph': + query = self.env[rec.model_name].get_query(domain, + rec.operation, + rec.measured_field, + group_by=rec.group_by) + try: + self._cr.execute(query) + except Exception as exc: + raise ValidationError( + _(f"Could'nt fetch data try another group by field for {rec.name} block")) from exc + records = self._cr.dictfetchall() + x_axis = [] + for record in records: + x_axis.append(record.get(rec.group_by.name)) + y_axis = [] + for record in records: + y_axis.append(record.get('value')) + vals.update({'x_axis': x_axis, 'y_axis': y_axis}) + else: + query = self.env[rec.model_name].get_query(domain, + rec.operation, + rec.measured_field) + self._cr.execute(query) + records = self._cr.dictfetchall() + magnitude = 0 + total = records[0].get('value') + while abs(total) >= 1000: + magnitude += 1 + total /= 1000.0 + val = f'{total:.2f}{" KMGTP"[magnitude]}' if magnitude else f'{total:.2f}' + records[0]['value'] = val + vals.update(records[0]) + block_id.append(vals) + return block_id diff --git a/odoo_dynamic_dashboard/models/dashboard_block_line.py b/odoo_dynamic_dashboard/models/dashboard_block_line.py new file mode 100644 index 000000000..f9b7c0f0c --- /dev/null +++ b/odoo_dynamic_dashboard/models/dashboard_block_line.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class DashboardBlockLine(models.Model): + """ Creates the model Dashboard Block Line""" + _name = "dashboard.block.line" + _description = "Dashboard Block Line" + + sequence = fields.Integer(string="Sequence", + help="Sequence of the block lines") + block_size = fields.Integer(string="Block size", + help="Block size of the dashboard block line") diff --git a/odoo_dynamic_dashboard/models/dashboard_menu.py b/odoo_dynamic_dashboard/models/dashboard_menu.py new file mode 100644 index 000000000..37220bec2 --- /dev/null +++ b/odoo_dynamic_dashboard/models/dashboard_menu.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class DashboardMenu(models.Model): + """ + This is the class DashboardMenu which is the subclass of the class Model + which is here used to create the model dashboard.menu. + """ + _name = "dashboard.menu" + _description = "Dashboard Menu" + + name = fields.Char(string="Name", help="Name of the dashboard") + parent_id = fields.Many2one('ir.ui.menu', string="Menu", + help="Parent of the dashboard") + group_ids = fields.Many2many('res.groups', string='Groups', + related='parent_id.groups_id', + help="User need to be at least in one " + "of these groups to see the menu") + client_action_id = fields.Many2one('ir.actions.client', + string='Client Action', + help="Client Action Related " + "to the dashboard") + menu_id = fields.Many2one('ir.ui.menu', string="Created Menu", + help="Created menu") + + @api.model + def create(self, vals): + """ + Summary: + This is the create function of the model DashboardMenu which is + triggered when creating a new record in this model. + Args: + vals: + The values when the user creating a new record. + Returns: + res: + Returns the created record at the end + """ + values = { + 'name': vals['name'], + 'tag': 'owl.dynamic_dashboard', + } + action_id = self.env['ir.actions.client'].create(values) + vals['client_action_id'] = action_id.id + menu_id = self.env['ir.ui.menu'].create({ + 'name': vals['name'], + 'parent_id': vals['parent_id'], + 'action': f'ir.actions.client,{action_id.id}' + }) + res = super(DashboardMenu, self).create(vals) + res.menu_id = menu_id.id + return res + + def write(self, vals): + """ + Summary: + This is the write function of the model DashboardMenu which is + triggered when changing any value in the corresponding record. + Args: + vals: + The values when the user creating a editing an record. + Returns: + Returns the updated record at the end + """ + if self.menu_id: + self.menu_id.update(vals) + return super(DashboardMenu, self).write(vals) + + def unlink(self): + """ + Summary: + This is the unlink function of the model DashboardMenu which is + triggered when unlinking any record in this model. + Returns: + Returns the record delete. + """ + self.menu_id.unlink() + return super(DashboardMenu, self).unlink() diff --git a/odoo_dynamic_dashboard/models/domain_to_sql.py b/odoo_dynamic_dashboard/models/domain_to_sql.py new file mode 100644 index 000000000..47c3c3ef1 --- /dev/null +++ b/odoo_dynamic_dashboard/models/domain_to_sql.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import models + + +def get_query(self, args, operation, field, group_by=False, apply_ir_rules=False): + """Dashboard block Query Creation""" + query = self._where_calc(args) + if apply_ir_rules: + self._apply_ir_rules(query, 'read') + if operation and field: + data = 'COALESCE(%s("%s".%s),0) AS value' % (operation.upper(), self._table, field.name) + join = '' + group_by_str = '' + if group_by: + if group_by.ttype == 'many2one': + relation_model = group_by.relation.replace('.', '_') + join = ' INNER JOIN %s on "%s".id = "%s".%s' % ( + relation_model, relation_model, self._table, group_by.name) + rec_name = self.env[group_by.relation]._rec_name_fallback() + data = data + ',"%s".%s AS %s' % (relation_model, rec_name, group_by.name) + group_by_str = ' Group by "%s".%s' % (relation_model, rec_name) + else: + data = data + ',"%s".%s' % (self._table, group_by.name) + group_by_str = ' Group by "%s".%s' % (self._table, str(group_by.name)) + else: + data = '"%s".id' % (self._table) + from_clause, where_clause, where_clause_params = query.get_sql() + where_str = where_clause and (" WHERE %s" % where_clause) or '' + if 'company_id' in self._fields: + if len(self.env.companies.ids) > 1: + operator = 'in' + company = str(tuple(self.env.companies.ids)) + else: + operator = '=' + company = self.env.companies.ids[0] + if where_str == '': + add = ' where' + else: + add = ' and' + multicompany_condition = '%s "%s".company_id %s %s' % (add, self._table, operator, company) + else: + multicompany_condition = '' + + query_str = 'SELECT %s FROM ' % data + from_clause + join + where_str + multicompany_condition + group_by_str + where_clause_params = map(lambda x: "'" + str(x) + "'", where_clause_params) + return query_str % tuple(where_clause_params) +models.BaseModel.get_query = get_query diff --git a/odoo_dynamic_dashboard/security/ir.model.access.csv b/odoo_dynamic_dashboard/security/ir.model.access.csv new file mode 100644 index 000000000..726d7d6b2 --- /dev/null +++ b/odoo_dynamic_dashboard/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_dashboard_block,access.dashboard.block,model_dashboard_block,base.group_user,1,1,1,1 +access_dashboard_menu,access.dashboard.menu,model_dashboard_menu,base.group_user,1,1,1,1 +access_dashboard_block_line,access.dashboard.block.line,model_dashboard_block_line,base.group_user,1,1,1,1 diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/capture (1).png b/odoo_dynamic_dashboard/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/capture (1).png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/check.png b/odoo_dynamic_dashboard/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/check.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/chevron.png b/odoo_dynamic_dashboard/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/chevron.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/cogs.png b/odoo_dynamic_dashboard/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/cogs.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/consultation.png b/odoo_dynamic_dashboard/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/consultation.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/ecom-black.png b/odoo_dynamic_dashboard/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/ecom-black.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/education-black.png b/odoo_dynamic_dashboard/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/education-black.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/hotel-black.png b/odoo_dynamic_dashboard/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/hotel-black.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/img.png b/odoo_dynamic_dashboard/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/img.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/license.png b/odoo_dynamic_dashboard/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/license.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/lifebuoy.png b/odoo_dynamic_dashboard/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/lifebuoy.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/manufacturing-black.png b/odoo_dynamic_dashboard/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/manufacturing-black.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/photo-capture.png b/odoo_dynamic_dashboard/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/photo-capture.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/pos-black.png b/odoo_dynamic_dashboard/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/pos-black.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/puzzle.png b/odoo_dynamic_dashboard/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/puzzle.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/restaurant-black.png b/odoo_dynamic_dashboard/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/restaurant-black.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/service-black.png b/odoo_dynamic_dashboard/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/service-black.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/trading-black.png b/odoo_dynamic_dashboard/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/trading-black.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/training.png b/odoo_dynamic_dashboard/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/training.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/update.png b/odoo_dynamic_dashboard/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/update.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/user.png b/odoo_dynamic_dashboard/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/user.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/icons/wrench.png b/odoo_dynamic_dashboard/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/wrench.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/Cybrosys R.png b/odoo_dynamic_dashboard/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/Cybrosys R.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/categories.png b/odoo_dynamic_dashboard/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/categories.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/check-box.png b/odoo_dynamic_dashboard/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/check-box.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/compass.png b/odoo_dynamic_dashboard/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/compass.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/corporate.png b/odoo_dynamic_dashboard/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/corporate.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/customer-support.png b/odoo_dynamic_dashboard/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/customer-support.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/cybrosys-logo.png b/odoo_dynamic_dashboard/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/cybrosys-logo.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/email.svg b/odoo_dynamic_dashboard/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/odoo_dynamic_dashboard/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/features.png b/odoo_dynamic_dashboard/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/features.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/logo.png b/odoo_dynamic_dashboard/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/logo.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/phone.svg b/odoo_dynamic_dashboard/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/odoo_dynamic_dashboard/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/pictures.png b/odoo_dynamic_dashboard/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/pictures.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/pie-chart.png b/odoo_dynamic_dashboard/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/pie-chart.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/right-arrow.png b/odoo_dynamic_dashboard/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/right-arrow.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/star (1) 2.svg b/odoo_dynamic_dashboard/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/odoo_dynamic_dashboard/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/star.png b/odoo_dynamic_dashboard/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/star.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/support (1) 1.svg b/odoo_dynamic_dashboard/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/odoo_dynamic_dashboard/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/support-email.svg b/odoo_dynamic_dashboard/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/odoo_dynamic_dashboard/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/support.png b/odoo_dynamic_dashboard/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/support.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/tick-mark.svg b/odoo_dynamic_dashboard/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/odoo_dynamic_dashboard/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/whatsapp 1.svg b/odoo_dynamic_dashboard/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/odoo_dynamic_dashboard/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/whatsapp.png b/odoo_dynamic_dashboard/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/misc/whatsapp.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/misc/whatsapp.svg b/odoo_dynamic_dashboard/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/odoo_dynamic_dashboard/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/1.png b/odoo_dynamic_dashboard/static/description/assets/modules/1.png new file mode 100644 index 000000000..ae3a880a2 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/1.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/2.png b/odoo_dynamic_dashboard/static/description/assets/modules/2.png new file mode 100644 index 000000000..d6b1fe049 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/2.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/3.png b/odoo_dynamic_dashboard/static/description/assets/modules/3.png new file mode 100644 index 000000000..8513873ea Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/3.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/4.png b/odoo_dynamic_dashboard/static/description/assets/modules/4.png new file mode 100644 index 000000000..5141a7802 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/4.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/5.png b/odoo_dynamic_dashboard/static/description/assets/modules/5.png new file mode 100644 index 000000000..469963f22 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/5.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/6.png b/odoo_dynamic_dashboard/static/description/assets/modules/6.png new file mode 100644 index 000000000..7cdd530f0 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/6.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/1.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..1abf4d2ed Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/1.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/2.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..05be2b949 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/2.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/3.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..84df91179 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/3.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/4.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..1c74a33f3 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/4.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/5.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..a6c309e52 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/5.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/6.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..49646b53b Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/6.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/7.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..65bbebc8f Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/7.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/hero.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/hero.png new file mode 100644 index 000000000..946ae80b8 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/hero.png differ diff --git a/odoo_dynamic_dashboard/static/description/banner.png b/odoo_dynamic_dashboard/static/description/banner.png new file mode 100644 index 000000000..10c9f3807 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/banner.png differ diff --git a/odoo_dynamic_dashboard/static/description/icon.png b/odoo_dynamic_dashboard/static/description/icon.png new file mode 100644 index 000000000..7979ee497 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/icon.png differ diff --git a/odoo_dynamic_dashboard/static/description/index.html b/odoo_dynamic_dashboard/static/description/index.html new file mode 100644 index 000000000..46aeabc17 --- /dev/null +++ b/odoo_dynamic_dashboard/static/description/index.html @@ -0,0 +1,777 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+
+
+
+
+

Odoo Dynamic Dashboard

+

+ Advanced Dashboard Module For Odoo17 +

+
+ +
+
+
+
+
+

+ Key Highlights +

+
+
+
+
+
+ +
+
+

+ Dynamic Dashboard +

+
+
+
+
+
+
+ +
+
+

+ Tile Configurations +

+
+
+
+
+
+
+ +
+
+

+ Chart Configurations +

+
+
+
+
+
+
+ +
+
+

+ Dynamic Menu Creation +

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

+ Add new tile or graph

+
+
+ +
+
+
+
+
+
+

+ Setting Up New Tile

+
+
+ +
+
+
+
+
+
+

+ Setting Up New Chart

+
+
+ +
+
+
+
+
+
+

+ Setting Up The Tile Configuration

+
+
+ +
+
+
+
+
+
+

+ Setting Up The Chart Configuration

+
+
+ +
+
+
+
+
+
+

+ List All Blocks Created +

+
+
+ +
+
+
+
+
+
+

+ Add A New Menu Under Existing Menus +

+
+
+ +
+
+
+
+
+
+
    +
  • + Dynamic Dashboard +
  • +
  • + Chart Configurations +
  • +
  • + Tile Configurations +
  • +
  • + Dynamic Menu Creation +
  • +
  • + Available in Community & Enterprise +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on: 2nd March 2024 +
+

+ Initial Commit for Odoo Dynamic Dashboard.

+
+
+
+
+
+
+
+

+ Related Products

+
+
+ +
+
+

+ Our Services

+ +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire + Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo + Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

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

+
+
+
+
+
+
+

+ Support

+
+
+
+
+
+
+
+ +
+ Need + Help? +

Got + questions or need help? Get in touch.

+
odoo@cybrosys.com +
+
+
+
+
+
+
+
+ +
+ WhatsApp +

Say hi to + us on WhatsApp!

+
+91 + 99456767686 +
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/odoo_dynamic_dashboard/static/src/js/DynamicDashboard.js b/odoo_dynamic_dashboard/static/src/js/DynamicDashboard.js new file mode 100644 index 000000000..cbdfd2213 --- /dev/null +++ b/odoo_dynamic_dashboard/static/src/js/DynamicDashboard.js @@ -0,0 +1,54 @@ +/** @odoo-module */ + +import { registry} from '@web/core/registry'; +import { DynamicDashboardTile} from './DynamicDashboardTile' +import { DynamicDashboardChart} from './DynamicDashboardChart' +import { useService } from "@web/core/utils/hooks"; +const { Component, mount} = owl +export class DynamicDashboard extends Component { + setup(){ + this.action = useService("action"); + this.rpc = this.env.services.rpc + this.renderDashboard() + } + async renderDashboard() { + const action = this.action + const rpc = this.rpc + await this.rpc('/get/values', {'action_id': this.props.actionId}).then(function(response){ + if ($('.o_dynamic_dashboard')[0]){ + for (let i = 0; i < response.length; i++) { + if (response[i].type === 'tile'){ + mount(DynamicDashboardTile, $('.o_dynamic_tile')[0], { props: { + widget: response[i], doAction: action + }}); + } + else{ + mount(DynamicDashboardChart, $('.o_dynamic_graph')[0], { props: { + widget: response[i], doAction: action, rpc: rpc + }}); + } + } + } + }) + } + async _onClick_add_block(e){ + var self = this; + var self_props = this.props; + var self_env = self.env; + var type = $(e.target).attr('data-type'); + await this.rpc('/create/tile',{'type' : type, 'action_id': self.props.actionId}).then(function(response){ + if(response['type'] == 'tile'){ + mount(DynamicDashboardTile, $('.o_dynamic_tile')[0], { props: { + widget: response, doAction: self.action + }}); + } + else{ + mount(DynamicDashboardChart, $('.o_dynamic_graph')[0], { props: { + widget: response, doAction: self.action + }}); + } + }) + } +} +DynamicDashboard.template = "owl.dynamic_dashboard" +registry.category("actions").add("owl.dynamic_dashboard", DynamicDashboard) diff --git a/odoo_dynamic_dashboard/static/src/js/DynamicDashboardChart.js b/odoo_dynamic_dashboard/static/src/js/DynamicDashboardChart.js new file mode 100644 index 000000000..743a27352 --- /dev/null +++ b/odoo_dynamic_dashboard/static/src/js/DynamicDashboardChart.js @@ -0,0 +1,82 @@ +/** @odoo-module */ + +import { registry} from '@web/core/registry'; +import { loadJS} from '@web/core/assets'; +import { getColor } from "@web/core/colors/colors"; +const { Component, xml, onWillStart, useRef, onMounted } = owl + +export class DynamicDashboardChart extends Component { + setup() { + this.doAction = this.props.doAction.doAction + this.chartRef = useRef("chart") + onWillStart(async () => { + await loadJS("https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.0/chart.umd.min.js") + }) + onMounted(()=> this.renderChart()) + } + renderChart(){ + if (this.props.widget.graph_type){ + const x_axis = this.props.widget.x_axis + const y_axis = this.props.widget.y_axis + const data = [] + for (let i = 0; i < x_axis.length; i++) { + const value = { key: x_axis[i], value: y_axis[i] } + data.push(value); + } + new Chart( + this.chartRef.el, + { + type: this.props.widget.graph_type || 'bar', + data: { + labels: data.map(row => row.key), + datasets: [ + { + label: this.props.widget.measured_field, + data: data.map(row => row.value), + backgroundColor: data.map((_, index) => getColor(index)), + hoverOffset : 4 + } + ] + }, + } + ); + } + } + async getConfiguration(){ + var id = this.props.widget.id + await this.doAction({ + type: 'ir.actions.act_window', + res_model: 'dashboard.block', + res_id: id, + view_mode: 'form', + views: [[false, "form"]] + }); + } +} +DynamicDashboardChart.template = xml ` +
+
+
+
+
+

+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+` + + diff --git a/odoo_dynamic_dashboard/static/src/js/DynamicDashboardTile.js b/odoo_dynamic_dashboard/static/src/js/DynamicDashboardTile.js new file mode 100644 index 000000000..8bd0c65e2 --- /dev/null +++ b/odoo_dynamic_dashboard/static/src/js/DynamicDashboardTile.js @@ -0,0 +1,51 @@ +/** @odoo-module */ + +import { registry} from '@web/core/registry'; +const { Component, xml } = owl +export class DynamicDashboardTile extends Component { + setup() { + super.setup(...arguments); + this.action = this.props.doAction + } + async getRecord() { + var model_name = this.props.widget.model_name + if (model_name){ + await this.action.doAction({ + type: 'ir.actions.act_window', + res_model: model_name, + view_mode: 'tree', + views: [[false, "tree"]] + }); + } + } + async getConfiguration() { + var id = this.props.widget.id + await this.action.doAction({ + type: 'ir.actions.act_window', + res_model: 'dashboard.block', + res_id: id, + view_mode: 'form', + views: [[false, "form"]] + }); + } +} +DynamicDashboardTile.template = xml`
+
+ + + +
+
+ +
+
+

+
+

+
+
+
+
+
` + diff --git a/odoo_dynamic_dashboard/static/src/scss/style.scss b/odoo_dynamic_dashboard/static/src/scss/style.scss new file mode 100644 index 000000000..4648339d0 --- /dev/null +++ b/odoo_dynamic_dashboard/static/src/scss/style.scss @@ -0,0 +1,109 @@ +.card{ + border: none; + border-radius: 0px; + box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; + -webkit-box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; +} +.card-header{ + background-color: transparent; + border: none; +} +:root { + /* Colors */ + --green: #00C689; + --blue: #3DA5F4; + --red: #F1536E; + --yellow: #FDA006; + /*Fonts*/ + --primary-font: 'Roboto', sans-serif; + } + + html .o_web_client > .o_action_manager { + overflow:auto; + } + + .bg-green { + background-color: var(--green); + } + + .bg-blue { + background-color: var(--blue); + } + + .bg-red { + background-color: var(--red); + } + + .bg-yellow { + background-color: var(--yellow); + } + + .text-color-yellow { + color: var(--yellow); + } + + .text-color-green { + color: var(--green); + } + + .text-color-blue { + color: var(--blue); + } + + .text-color-red { + color: var(--red); + } + + .text-color-yellow { + color: var(--yellow); + } + + .tile-container { + padding: 3.2rem 1.5rem; + border-radius: 2rem; + } + + .tile-container__icon-container { + border-radius: 50%; + width: 4.75rem; + height: 4.75rem; + font-size: 28px; + } + + .status-container__title { + font-family: var(--primary-font); + font-weight: 500; + font-size: 1.5rem; + line-height: 1.5rem; + } + + .status-container__figures { + font-family: var(--primary-font); + } + + .status-container__figures>h3 { + font-weight: 700; + font-size: 1.5rem; + line-height: 1.813rem; + } + + .tile-container__setting-icon { + top: 0.638rem; + right: 1rem; + } + +// Main Navbar Dropdown menu location override +.o_menu_systray > .o_user_menu > .o-dropdown--menu{ + left: auto !important; + right: 0px !important; +} +.button-container{ + padding-top: 5px; +} +.add_block{ + margin-left: 6px; +} +.tile-container__status-container{ + padding-left: 7px; +} diff --git a/odoo_dynamic_dashboard/static/src/xml/dynamic_dashboard_template.xml b/odoo_dynamic_dashboard/static/src/xml/dynamic_dashboard_template.xml new file mode 100644 index 000000000..fe1372a49 --- /dev/null +++ b/odoo_dynamic_dashboard/static/src/xml/dynamic_dashboard_template.xml @@ -0,0 +1,21 @@ + + + +
+
+ + +
+
+
+
+
+
+
+
+
+
diff --git a/odoo_dynamic_dashboard/views/dashboard_menu_view.xml b/odoo_dynamic_dashboard/views/dashboard_menu_view.xml new file mode 100644 index 000000000..d903439da --- /dev/null +++ b/odoo_dynamic_dashboard/views/dashboard_menu_view.xml @@ -0,0 +1,46 @@ + + + + + dashboard.menu.view.form + dashboard.menu + +
+ + + + + + + + + + +
+
+
+ + + dashboard.menu.view.tree + dashboard.menu + + + + + + + + + + Dashboard Menu + ir.actions.act_window + dashboard.menu + tree,form + + + + + +
diff --git a/odoo_dynamic_dashboard/views/dashboard_view.xml b/odoo_dynamic_dashboard/views/dashboard_view.xml new file mode 100644 index 000000000..9d2187da2 --- /dev/null +++ b/odoo_dynamic_dashboard/views/dashboard_view.xml @@ -0,0 +1,13 @@ + + + + + Dashboard + owl.dynamic_dashboard + + + + + + diff --git a/odoo_dynamic_dashboard/views/dynamic_block_view.xml b/odoo_dynamic_dashboard/views/dynamic_block_view.xml new file mode 100644 index 000000000..b310d1b55 --- /dev/null +++ b/odoo_dynamic_dashboard/views/dynamic_block_view.xml @@ -0,0 +1,79 @@ + + + + + dashboard.block.view.form + dashboard.block + +
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + dashboard.block.view.tree + dashboard.block + + + + + + + + + + + Dashboard Block + ir.actions.act_window + dashboard.block + tree,form + {'default_edit_mode' : True} + + + +