diff --git a/odoo_dynamic_dashboard/README.md b/odoo_dynamic_dashboard/README.md new file mode 100755 index 000000000..be94c4207 --- /dev/null +++ b/odoo_dynamic_dashboard/README.md @@ -0,0 +1,34 @@ +Odoo Dynamic Dashboard +====================== + +Dynamically Arrange the dashboard to get the information that are relevant to your business, department, or a specific process or need. + + +Installation +============ +- www.odoo.com/documentation/14.0/setup/install.html +- Install our custom addon + +License +======= +GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(http://www.gnu.org/licenses/agpl.html) + +Bug Tracker +=========== +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Credits +======= +* Cybrosys Techno Solutions + +Author +------ +Developer: Irfan @ Cybrosys, Afras @Cybrosys + +Maintainer +---------- +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. + diff --git a/odoo_dynamic_dashboard/__init__.py b/odoo_dynamic_dashboard/__init__.py new file mode 100644 index 000000000..54752ce10 --- /dev/null +++ b/odoo_dynamic_dashboard/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL 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..21a43ecdb --- /dev/null +++ b/odoo_dynamic_dashboard/__manifest__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': "Odoo Dynamic Dashboard", + 'version': '14.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', + 'website': "https://www.cybrosys.com", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'depends': ['base', 'web'], + 'data': [ + 'views/dashboard_view.xml', + 'views/dynamic_block_view.xml', + 'views/dashboard_menu_view.xml', + 'security/ir.model.access.csv', + ], + 'images': ['static/description/banner.png'], + 'qweb': ["static/src/xml/dynamic_dashboard_template.xml"], + 'license': "AGPL-3", + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/odoo_dynamic_dashboard/controllers/__init__.py b/odoo_dynamic_dashboard/controllers/__init__.py new file mode 100644 index 000000000..0cdabcead --- /dev/null +++ b/odoo_dynamic_dashboard/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from . import main diff --git a/odoo_dynamic_dashboard/controllers/main.py b/odoo_dynamic_dashboard/controllers/main.py new file mode 100644 index 000000000..96624d86d --- /dev/null +++ b/odoo_dynamic_dashboard/controllers/main.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from odoo import http, _ +from odoo.http import request +from odoo.exceptions import UserError + + +class DynamicDashboard(http.Controller): + + @http.route('/create/tile', type='json', auth='user') + def tile_creation(self, **kw): + """While clicking ADD Block""" + type = kw.get('type') + action_id = kw.get('action_id') + tile_id = request.env['dashboard.block'].sudo().create({ + 'name': 'New Block', + 'type': type, + 'tile_color': '#1f6abb', + 'text_color': '#FFFFFF', + 'fa_icon': 'fa fa-money', + 'edit_mode': True, + 'client_action': int(action_id), + }) + + return {'id': tile_id.id, 'name': tile_id.name, 'type': type, 'icon': 'fa fa-money', + 'color': 'background-color: #1f6abb;', + 'text_color': 'color: #FFFFFF', + 'icon_color': 'color: #1f6abb'} + + @http.route('/tile/details', type='json', auth='user') + def tile_details(self, **kw): + tile_id = request.env['dashboard.block'].sudo().search([('id', '=', kw.get('id'))]) + if tile_id: + return {'model': tile_id.model_id.model, 'filter': tile_id.filter, 'model_name': tile_id.model_id.name} + return False diff --git a/odoo_dynamic_dashboard/doc/RELEASE_NOTES.md b/odoo_dynamic_dashboard/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..b7daf4eeb --- /dev/null +++ b/odoo_dynamic_dashboard/doc/RELEASE_NOTES.md @@ -0,0 +1,8 @@ + +## Module + +#### 14.12.2021 +#### Version 14.0.1.0.0 + +##### 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..1a4f700b1 --- /dev/null +++ b/odoo_dynamic_dashboard/models/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from . import dashboard_block +from . import domain_to_sql +from . import dashboard_menu diff --git a/odoo_dynamic_dashboard/models/dashboard_block.py b/odoo_dynamic_dashboard/models/dashboard_block.py new file mode 100644 index 000000000..9f9a7d962 --- /dev/null +++ b/odoo_dynamic_dashboard/models/dashboard_block.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from odoo import models, fields, api +from odoo.osv import expression +from ast import literal_eval + + +class DashboardBlock(models.Model): + _name = "dashboard.block" + _description = "Dashboard Blocks" + _rec_name = "name" + + def get_default_action(self): + action_id = self.env.ref('odoo_dynamic_dashboard.action_dynamic_dashboard') + if action_id: + return action_id.id + else: + return False + + name = fields.Char(string="Name", help='Name of the block') + field_id = fields.Many2one('ir.model.fields', 'Measured Field',domain="[('store', '=', True), ('model_id', '=', model_id), ('ttype', 'in', ['float','integer','monetary'])]") + fa_icon = fields.Char(string="Icon") + graph_size = fields.Selection( + selection=[("col-lg-4", "Small"), ("col-lg-6", "Medium"), ("col-lg-12", "Large")], + string="Graph Size",default='col-lg-4') + 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", "Measured Field") + client_action = fields.Many2one('ir.actions.client', default = get_default_action) + + 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") + y_axis = fields.Char(string="Y-Axis") + group_by = fields.Many2one("ir.model.fields", store=True, string="Group by(Y-Axis)", help='Field value for Y-Axis') + 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") + model_id = fields.Many2one('ir.model', 'Model') + model_name = fields.Char(related='model_id.model', readonly=True) + + filter_by = fields.Many2one("ir.model.fields", string=" Filter By") + filter_values = fields.Char(string="Filter Values") + + sequence = fields.Integer(string="Sequence") + edit_mode = fields.Boolean(default=False, invisible=True) + + def get_dashboard_vals(self, action_id): + """Dashboard block values""" + block_id = [] + dashboard_block = self.env['dashboard.block'].sudo().search([('client_action', '=', int(action_id))]) + for rec in dashboard_block: + color = rec.tile_color if rec.tile_color else '#1f6abb;' + icon_color = rec.tile_color if rec.tile_color else '#1f6abb;' + text_color = rec.text_color if rec.text_color else '#FFFFFF;' + vals = { + 'id': rec.id, + 'name': rec.name, + 'type': rec.type, + 'graph_type': rec.graph_type, + 'icon': rec.fa_icon, + 'cols': rec.graph_size, + 'color': 'background-color: %s;' % color, + 'text_color': 'color: %s;' % text_color, + 'icon_color': 'color: %s;' % icon_color, + } + 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) + self._cr.execute(query) + 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 + # add more suffixes if you need them + val = '%.2f%s' % (total, ['', 'K', 'M', 'G', 'T', 'P'][magnitude]) + + # if rec.measured_field.ttype == 'monetary': + # amount = str( + # value) + currency_id.symbol if currency_id.position == 'after' else currency_id.symbol + str( + # value) + records[0]['value'] = val + vals.update(records[0]) + block_id.append(vals) + return block_id + + +class DashboardBlockLine(models.Model): + _name = "dashboard.block.line" + + sequence = fields.Integer(string="Sequence") + block_size = fields.Integer(string="Block size") diff --git a/odoo_dynamic_dashboard/models/dashboard_menu.py b/odoo_dynamic_dashboard/models/dashboard_menu.py new file mode 100644 index 000000000..0c8573ab1 --- /dev/null +++ b/odoo_dynamic_dashboard/models/dashboard_menu.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from odoo import models, fields, api +from odoo.osv import expression + + +class DashboardMenu(models.Model): + _name = "dashboard.menu" + _description = "Dashboard Menu" + _rec_name = "name" + + name = fields.Char(string="Name") + menu_id = fields.Many2one('ir.ui.menu', string="Menu") + group_ids = fields.Many2many('res.groups', string='Groups', + related='menu_id.groups_id', + help="User need to be at least in one of these groups to see the menu") + client_action = fields.Many2one('ir.actions.client') + + @api.model + def create(self, vals): + """This code is to create menu""" + values = { + 'name': vals['name'], + 'tag': 'dynamic_dashboard', + } + action_id = self.env['ir.actions.client'].create(values) + vals['client_action'] = action_id.id + menu_id = self.env['ir.ui.menu'].create({ + 'name': vals['name'], + 'parent_id': vals['menu_id'], + 'action': 'ir.actions.client,%d' % (action_id.id,) + }) + return super(DashboardMenu, self).create(vals) 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..9ebd7dbb4 --- /dev/null +++ b/odoo_dynamic_dashboard/models/domain_to_sql.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from odoo.osv import expression +from odoo import models +from odoo.release import version_info + + +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..39d2b04eb --- /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 \ No newline at end of file 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/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/logo.png b/odoo_dynamic_dashboard/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/logo.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/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/tiny-star.png b/odoo_dynamic_dashboard/static/description/assets/icons/tiny-star.png new file mode 100644 index 000000000..3205e6e0c Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/icons/tiny-star.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/modules/approval_image.png b/odoo_dynamic_dashboard/static/description/assets/modules/approval_image.png new file mode 100644 index 000000000..84fe94e80 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/approval_image.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/budget_image.png b/odoo_dynamic_dashboard/static/description/assets/modules/budget_image.png new file mode 100644 index 000000000..fe6aa6fe4 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/budget_image.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/follow_image.png b/odoo_dynamic_dashboard/static/description/assets/modules/follow_image.png new file mode 100644 index 000000000..16582ca06 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/follow_image.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/multiple-ref_image.png b/odoo_dynamic_dashboard/static/description/assets/modules/multiple-ref_image.png new file mode 100644 index 000000000..3fe90e552 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/multiple-ref_image.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/pos_image.png b/odoo_dynamic_dashboard/static/description/assets/modules/pos_image.png new file mode 100644 index 000000000..c5932894b Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/pos_image.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/pos_order_image.png b/odoo_dynamic_dashboard/static/description/assets/modules/pos_order_image.png new file mode 100644 index 000000000..1217263a6 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/pos_order_image.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/modules/shopify_image.png b/odoo_dynamic_dashboard/static/description/assets/modules/shopify_image.png new file mode 100644 index 000000000..c6d92c16d Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/modules/shopify_image.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/block.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/block.png new file mode 100644 index 000000000..463565820 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/block.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/chart_form.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/chart_form.png new file mode 100644 index 000000000..ae1e173ef Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/chart_form.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/chart_set.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/chart_set.png new file mode 100644 index 000000000..279ebba01 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/chart_set.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/dashboard-screenshot.jpg b/odoo_dynamic_dashboard/static/description/assets/screenshots/dashboard-screenshot.jpg new file mode 100644 index 000000000..eebb6f9a6 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/dashboard-screenshot.jpg differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/graph.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/graph.png new file mode 100644 index 000000000..f48762a3e Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/graph.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/hero.jpg b/odoo_dynamic_dashboard/static/description/assets/screenshots/hero.jpg new file mode 100644 index 000000000..d6c8f5f96 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/hero.jpg differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/menu_create.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/menu_create.png new file mode 100644 index 000000000..5cdd1c417 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/menu_create.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/responsive-screenshot-1.jpg b/odoo_dynamic_dashboard/static/description/assets/screenshots/responsive-screenshot-1.jpg new file mode 100644 index 000000000..065d6beba Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/responsive-screenshot-1.jpg differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/responsive-screenshot-2.jpg b/odoo_dynamic_dashboard/static/description/assets/screenshots/responsive-screenshot-2.jpg new file mode 100644 index 000000000..32f7880e7 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/responsive-screenshot-2.jpg differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/responsive-screenshot-3.jpg b/odoo_dynamic_dashboard/static/description/assets/screenshots/responsive-screenshot-3.jpg new file mode 100644 index 000000000..269f0b4cd Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/responsive-screenshot-3.jpg differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/screenshot-1.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/screenshot-1.png new file mode 100644 index 000000000..d06ac1f46 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/screenshot-1.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/screenshot-2.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/screenshot-2.png new file mode 100644 index 000000000..74a069286 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/screenshot-2.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/side-bar.jpg b/odoo_dynamic_dashboard/static/description/assets/screenshots/side-bar.jpg new file mode 100644 index 000000000..e73d625a0 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/side-bar.jpg differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/tile.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/tile.png new file mode 100644 index 000000000..81d180ae8 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/tile.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/tile_form.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/tile_form.png new file mode 100644 index 000000000..4cd6c6560 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/tile_form.png differ diff --git a/odoo_dynamic_dashboard/static/description/assets/screenshots/tile_set.png b/odoo_dynamic_dashboard/static/description/assets/screenshots/tile_set.png new file mode 100644 index 000000000..f0a58fee8 Binary files /dev/null and b/odoo_dynamic_dashboard/static/description/assets/screenshots/tile_set.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..713d6dee5 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..684313beb 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..2fb27ba0a --- /dev/null +++ b/odoo_dynamic_dashboard/static/description/index.html @@ -0,0 +1,537 @@ + +
+ +
+
+ +
+
+ +
+
+ +
+
+ Community +
+ +
+
+ +
+ + +
+
+ +
+
+ +
+
+ +
+
+
+

+ Dashboard Views

+
+
+
+
+
+
+

+ Multiple Ways To Arrange
Your Dashboard +

+

Dynamically Arrange the dashboard to get the + information that are relevant to your business, department, or a specific process or need. +

+ +
+
+
+
+ New +

+ View top deals easily +

+

View Top deals easily from dashboards based on current data leads to + time + savings.

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

+ Screenshots

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

+ Suggested Products

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

+ Our + Services

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

+ Our + Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

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

+ Mobile + friendly, + awe-inspiring product pages

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

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

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

+ An + all-inclusive + hotel management application

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

+ Need + Help?

+
+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
diff --git a/odoo_dynamic_dashboard/static/src/js/dynamic_dashboard.js b/odoo_dynamic_dashboard/static/src/js/dynamic_dashboard.js new file mode 100644 index 000000000..9951f4d5c --- /dev/null +++ b/odoo_dynamic_dashboard/static/src/js/dynamic_dashboard.js @@ -0,0 +1,269 @@ +odoo.define('odoo_dynamic_dashboard.Dashboard', function (require) { +"use strict"; + +var AbstractAction = require('web.AbstractAction'); +var ajax = require('web.ajax'); +var core = require('web.core'); +var rpc = require('web.rpc'); +var session = require('web.session'); +var web_client = require('web.web_client'); +var _t = core._t; +var QWeb = core.qweb; + +var DynamicDashboard = AbstractAction.extend({ + template: 'dynamic_dashboard', + events: { + 'click .add_block': '_onClick_add_block', + 'click .add_grapgh': '_onClick_add_grapgh', + 'click .block_setting': '_onClick_block_setting', + 'click .tile': '_onClick_tile', + }, + + init: function(parent, context) { + this.action_id = context['id']; + this._super(parent, context); + this.block_ids = [] + }, + + start: function() { + var self = this; + this.set("title", 'Dashboard'); + + return this._super().then(function() { + self.render_dashboards(); + }); + }, + + + willStart: function() { + var self = this; + return $.when(ajax.loadLibs(this), this._super()).then(function() { + return self.fetch_data(); + }); + }, + + fetch_data: function() { + var self = this; + var def1 = this._rpc({ + model: 'dashboard.block', + method: 'get_dashboard_vals', + args: [[],this.action_id] + }).then(function(result) { + self.block_ids = result; + }); + return $.when(def1); + }, + + get_colors : function(x_axis) { + var color = [] + for (var j = 0; j < x_axis.length; j++) { + var r = Math.floor(Math.random() * 255); + var g = Math.floor(Math.random() * 255); + var b = Math.floor(Math.random() * 255); + color.push("rgb(" + r + "," + g + "," + b + ")"); + } + return color + }, + + get_values_bar : function(block){ + var labels = block['x_axis'] + var data = { + labels: labels, + datasets: [{ + label: "", + data: block['y_axis'], + backgroundColor: this.get_colors(block['x_axis']), + borderColor: 'rgba(200, 200, 200, 0.75)', + borderWidth: 1 + }] + }; + + var options = { + scales: { + y: { + beginAtZero: true + } + } + }, + bar_data = [data,options] + return bar_data; + }, + + get_values_pie : function(block){ + var data = { + labels: block['x_axis'], + datasets: [{ + label: '', + data: block['y_axis'], + backgroundColor: this.get_colors(block['x_axis']), + hoverOffset: 4 + }] + }; + var options = { }, + pie_data = [data,options] + return pie_data; + }, + + get_values_line : function(block){ + var labels = block['x_axis'] + var data = { + labels: labels, + datasets: [{ + label: '', + data: block['y_axis'], + fill: false, + borderColor: 'rgb(75, 192, 192)', + tension: 0.1 + }] + }; + var options = { }, + line_data = [data,options] + return line_data; + + }, + + get_values_doughnut : function(block){ + var data = { + labels: block['x_axis'], + datasets: [{ + label: '', + data: block['y_axis'], + backgroundColor: this.get_colors(block['x_axis']), + hoverOffset: 4 + }] + }; + var options = { }, + doughnut_data = [data,options] + return doughnut_data; + + + }, + + get_values_radar : function(block){ + var data = { + labels: block['x_axis'], + datasets: [{ + label: '', + data: block['y_axis'], + fill: true, + backgroundColor: 'rgba(255, 99, 132, 0.2)', + borderColor: 'rgb(255, 99, 132)', + pointBackgroundColor: 'rgb(255, 99, 132)', + pointBorderColor: '#fff', + pointHoverBackgroundColor: '#fff', + pointHoverBorderColor: 'rgb(255, 99, 132)' + }] + }; + var options = { + elements: { + line: { + borderWidth: 3 + } + } + }, + radar_data = [data,options] + return radar_data; + }, + + render_dashboards: function() { + var self = this; + _.each(this.block_ids, function(block) { + if (block['type'] == 'tile') { + self.$('.o_dynamic_dashboard').append(QWeb.render('DynamicDashboardTile', {widget: block})); + } + else{ + self.$('.o_dynamic_chart').append(QWeb.render('DynamicDashboardChart', {widget: block})); + var element = $('[data-id=' + block['id'] + ']') + if (!('x_axis' in block)){ + return false + } + var ctx =self.$('.chart_graphs').last() + var type = block['graph_type'] + var chart_type = 'self.get_values_' + `${type}(block)` + var data = eval(chart_type) + //create Chart class object + var chart = new Chart(ctx, { + type: type, + data: data[0], + options: data[1] + }); + } + }); + }, + + _onClick_block_setting : function(event){ + event.stopPropagation(); + var self = this; + var id = $(event.currentTarget).closest('.block').attr('data-id'); + this.do_action({ + type: 'ir.actions.act_window', + res_model: 'dashboard.block', + view_mode: 'form', + res_id: parseInt(id), + views: [[false,'form']], + context: {'form_view_initial_mode': 'edit'}, + }); + }, + + _onClick_add_block : function(e){ + var self = this; + var type = $(e.currentTarget).attr('data-type'); + ajax.jsonRpc('/create/tile', 'call', { + 'type' : type, + 'action_id' : self.action_id + }).then(function (result) { + if(result['type'] == 'tile'){ + self.$('.o_dynamic_dashboard').append(QWeb.render('DynamicDashboardTile', {widget: result})); + } + else{ + self.$('.o_dynamic_chart').append(QWeb.render('DynamicDashboardChart', {widget: result})); + var element = $('[data-id=' + result['id'] + ']') + var ctx =self.$('.chart_graphs').last() + var options = { + type: 'bar', + data: { + labels: [], + datasets: [ + { + data: [], + borderWidth: 1 + }, + ] + }, + } + var chart = new Chart(ctx, { + type: "bar", + data: options + }); + } + }); + }, + + _onClick_tile : function(e){ + e.stopPropagation(); + var self = this; + var id = $(e.currentTarget).attr('data-id'); + ajax.jsonRpc('/tile/details', 'call', { + 'id': id + }).then(function (result) { + self.do_action({ + name : result['model_name'], + type: 'ir.actions.act_window', + res_model:result['model'] , + view_mode: 'tree,form', + views: [[false, 'list'], [false, 'form']], + domain: result['filter'] + }); + }); + }, + + + +}); + + +core.action_registry.add('dynamic_dashboard', DynamicDashboard); + +return DynamicDashboard; + +}); 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..0a174cf44 --- /dev/null +++ b/odoo_dynamic_dashboard/static/src/scss/style.scss @@ -0,0 +1,94 @@ +.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; + } \ No newline at end of file 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..ab0e30642 --- /dev/null +++ b/odoo_dynamic_dashboard/static/src/xml/dynamic_dashboard_template.xml @@ -0,0 +1,71 @@ + + + +
+ + +
+
+
+
+
+
+ +
+
+ +
+ +
+
+

+
+

+
+
+
+
+
+ + + + + + Dashboard + + +
+
+
+
+
+

+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
\ No newline at end of file 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..672a9e145 --- /dev/null +++ b/odoo_dynamic_dashboard/views/dashboard_menu_view.xml @@ -0,0 +1,44 @@ + + + dashboard.menu.form.view + dashboard.menu + +
+ + + + + + + + + + +
+
+
+ + + dashboard.menu.tree.view + dashboard.menu + + + + + + + + + + Dashboard Menu + ir.actions.act_window + dashboard.menu + tree,form + + + + + +
\ No newline at end of file diff --git a/odoo_dynamic_dashboard/views/dashboard_view.xml b/odoo_dynamic_dashboard/views/dashboard_view.xml new file mode 100644 index 000000000..4ce753fa3 --- /dev/null +++ b/odoo_dynamic_dashboard/views/dashboard_view.xml @@ -0,0 +1,23 @@ + + + + Dashboard + dynamic_dashboard + + + + + +