diff --git a/advanced_dynamic_dashboard/README.rst b/advanced_dynamic_dashboard/README.rst index fbafb1721..09595b9c3 100755 --- a/advanced_dynamic_dashboard/README.rst +++ b/advanced_dynamic_dashboard/README.rst @@ -1,20 +1,19 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html +.. 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 Advanced 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/16.0/setup/install.html - - Install our custom addon +Configuration +============= +- No configuration needed License ------- -GNU AFFERO GENERAL PUBLIC LICENSE Version 3 (AGPL v3) -(https://www.odoo.com/documentation/user/16.0/legal/licenses/licenses.html) +AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPL v3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) Company ------- @@ -22,16 +21,17 @@ Company Credits ------- -* Developer: -(V16) Robin @Cybrosys, Afra MP @Cybrosys +* Developer: (V16) Robin, Afra MP, 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. +Bugs are tracked on GitHub Issues. In case of trouble, please check there if +your issue has already been reported. Maintainer ========== diff --git a/advanced_dynamic_dashboard/__init__.py b/advanced_dynamic_dashboard/__init__.py index de023e83f..9e0d4f0e3 100755 --- a/advanced_dynamic_dashboard/__init__.py +++ b/advanced_dynamic_dashboard/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -################################################################################ +############################################################################# # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Robin, Afra MP (odoo@cybrosys.com) +# 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. @@ -18,7 +18,8 @@ # (AGPL v3) along with this program. # If not, see . # -################################################################################ +############################################################################# from . import controllers from . import models - +from . import wizard +from .hooks import uninstall_hook diff --git a/advanced_dynamic_dashboard/__manifest__.py b/advanced_dynamic_dashboard/__manifest__.py index 451b3e836..e04813846 100755 --- a/advanced_dynamic_dashboard/__manifest__.py +++ b/advanced_dynamic_dashboard/__manifest__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -################################################################################ +############################################################################# # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Robin, Afra MP (odoo@cybrosys.com) +# 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. @@ -18,41 +18,44 @@ # (AGPL v3) along with this program. # If not, see . # -################################################################################ +############################################################################# { 'name': "Advanced Dynamic Dashboard", - 'version': '16.0.2.0.1', + 'version': '16.0.2.1.2', 'category': 'Productivity', - 'summary': """Create Configurable Dashboards Easily""", + 'summary': """Odoo Dynamic Dashboard, Dynamic Dashboard, Odoo Dashboard, Dynamic Dashbaord, AI Dashboard, Odoo17 Dashboard, Dashboard, Odoo17, Configurable Dashboard""", 'description': """Create Configurable Advanced Dynamic Dashboard to get the information that are relevant to your business, department, or a specific process or need""", 'author': 'Cybrosys Techno Solutions', - 'website': "https://www.cybrosys.com", 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', - 'depends': ['base', 'web'], + 'website': "https://www.cybrosys.com", + 'depends': ['web'], 'data': [ 'security/ir.model.access.csv', 'views/dashboard_views.xml', 'views/dynamic_block_views.xml', 'views/dashboard_menu_views.xml', + 'wizard/dashboard_mail_views.xml', ], 'assets': { 'web.assets_backend': [ 'advanced_dynamic_dashboard/static/lib/css/gridstack.min.css', 'advanced_dynamic_dashboard/static/src/css/dynamic_dashboard.css', 'advanced_dynamic_dashboard/static/src/scss/dynamic_dashboard.scss', - "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css", + 'https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css', 'https://cdnjs.cloudflare.com/ajax/libs/gridstack.js/0.2.6/gridstack.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.bundle.js', - "https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js", - "https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js", + 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js', + 'https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js', + 'https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.3/html2pdf.bundle.min.js', + 'https://cdn.jsdelivr.net/npm/exceljs@4.4.0/dist/exceljs.min.js', 'advanced_dynamic_dashboard/static/src/js/dynamic_dashboard.js', 'advanced_dynamic_dashboard/static/src/xml/dynamic_dashboard_template.xml', - 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700' + 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700', ], }, 'images': ['static/description/banner.png'], @@ -60,4 +63,5 @@ 'installable': True, 'auto_install': False, 'application': True, + 'uninstall_hook': 'uninstall_hook', } diff --git a/advanced_dynamic_dashboard/controllers/__init__.py b/advanced_dynamic_dashboard/controllers/__init__.py index eeb24981c..eeb473ce9 100755 --- a/advanced_dynamic_dashboard/controllers/__init__.py +++ b/advanced_dynamic_dashboard/controllers/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -################################################################################ +############################################################################# # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Robin, Afra MP (odoo@cybrosys.com) +# 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. @@ -18,5 +18,5 @@ # (AGPL v3) along with this program. # If not, see . # -################################################################################ +############################################################################# from . import advanced_dynamic_dashboard diff --git a/advanced_dynamic_dashboard/controllers/advanced_dynamic_dashboard.py b/advanced_dynamic_dashboard/controllers/advanced_dynamic_dashboard.py index 0c15ae873..abf7ea8c1 100755 --- a/advanced_dynamic_dashboard/controllers/advanced_dynamic_dashboard.py +++ b/advanced_dynamic_dashboard/controllers/advanced_dynamic_dashboard.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -################################################################################ +############################################################################# # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Robin, Afra MP (odoo@cybrosys.com) +# 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. @@ -18,7 +18,7 @@ # (AGPL v3) along with this program. # If not, see . # -################################################################################ +############################################################################# from odoo import http from odoo.http import request diff --git a/advanced_dynamic_dashboard/doc/RELEASE_NOTES.md b/advanced_dynamic_dashboard/doc/RELEASE_NOTES.md index 2291cb4b0..3a535a7c2 100755 --- a/advanced_dynamic_dashboard/doc/RELEASE_NOTES.md +++ b/advanced_dynamic_dashboard/doc/RELEASE_NOTES.md @@ -1,6 +1,6 @@ ## Module -#### 15.07.2023 +#### 22.03.2024 #### Version 16.0.1.0.0 #### ADD - Initial commit for Advanced Dynamic Dashboard \ No newline at end of file diff --git a/advanced_dynamic_dashboard/hooks.py b/advanced_dynamic_dashboard/hooks.py new file mode 100644 index 000000000..8d8513a9b --- /dev/null +++ b/advanced_dynamic_dashboard/hooks.py @@ -0,0 +1,27 @@ +# -*- 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, SUPERUSER_ID + + +def uninstall_hook(cr, registry): + env = api.Environment(cr, SUPERUSER_ID, {}) + env['dashboard.menu'].search([]).unlink() diff --git a/advanced_dynamic_dashboard/models/__init__.py b/advanced_dynamic_dashboard/models/__init__.py index 756c8512f..6dc5d2bf4 100755 --- a/advanced_dynamic_dashboard/models/__init__.py +++ b/advanced_dynamic_dashboard/models/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -################################################################################ +############################################################################# # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Robin, Afra MP (odoo@cybrosys.com) +# 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. @@ -18,7 +18,7 @@ # (AGPL v3) along with this program. # If not, see . # -################################################################################ +############################################################################# from . import dashboard_block from . import dashboard_menu from . import domain_to_sql diff --git a/advanced_dynamic_dashboard/models/dashboard_block.py b/advanced_dynamic_dashboard/models/dashboard_block.py index 901f85ce3..f7ce58ab6 100755 --- a/advanced_dynamic_dashboard/models/dashboard_block.py +++ b/advanced_dynamic_dashboard/models/dashboard_block.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -################################################################################ +############################################################################# # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Robin, Afra MP (odoo@cybrosys.com) +# 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. @@ -18,11 +18,10 @@ # (AGPL v3) along with this program. # If not, see . # -################################################################################ +############################################################################# from ast import literal_eval from datetime import datetime - -from odoo import fields, models +from odoo import fields, models, api from odoo.osv import expression @@ -43,10 +42,6 @@ class DashboardBlock(models.Model): name = fields.Char(string="Name", help='Name of the block') fa_icon = fields.Char(string="Icon", help="Add icon for tile") - 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="Select the graph size") operation = fields.Selection( selection=[("sum", "Sum"), ("avg", "Average"), ("count", "Count")], string="Operation", @@ -59,7 +54,8 @@ class DashboardBlock(models.Model): string="Chart Type", help='Type of Chart') measured_field_id = fields.Many2one("ir.model.fields", string="Measured Field", - help="Select the Measured") + help="Select the Measured", + create=False, edit=False) client_action_id = fields.Many2one('ir.actions.client', string="Client action", default=get_default_action, @@ -75,10 +71,13 @@ class DashboardBlock(models.Model): width = fields.Integer(string="width", help="Chart width") group_by_id = fields.Many2one("ir.model.fields", store=True, string="Group by(Y-Axis)", - help='Field value for Y-Axis') + help='Field value for Y-Axis', create=False, + edit=False) tile_color = fields.Char(string="Tile Color", help='Primary Color of Tile') - text_color = fields.Char(string="Text Color", help='Text Color of Tile') - val_color = fields.Char(string="Value Color", help='Value Color of Tile') + text_color = fields.Char(string="Text Color", help='Text Color of Tile', + default='#FFFFFF') + val_color = fields.Char(string="Value Color", help='Value Color of Tile', + default='#FFFFFF') fa_color = fields.Char(string="Icon Color", help='Icon Color of Tile') filter = fields.Char(string="Filter", help="Add filter") model_id = fields.Many2one('ir.model', string='Model', @@ -93,7 +92,7 @@ class DashboardBlock(models.Model): """Fetch block values from js and create chart""" block_id = [] for rec in self.env['dashboard.block'].sudo().search( - [('client_action_id', '=', int(action_id))]): + [('client_action_id', '=', int(action_id))]): if rec.filter is False: rec.filter = "[]" @@ -101,8 +100,7 @@ class DashboardBlock(models.Model): # Remove existing date filters if they exist filter_list = [filter_item for filter_item in filter_list if not ( - isinstance(filter_item, tuple) and filter_item[ - 0] == 'create_date')] + isinstance(filter_item, tuple) and filter_item[0] == 'create_date')] if start_date and start_date != 'null': start_date_obj = datetime.strptime(start_date, '%Y-%m-%d') @@ -115,15 +113,14 @@ class DashboardBlock(models.Model): ('create_date', '<=', end_date_obj.strftime('%Y-%m-%d'))) rec.filter = repr(filter_list) - 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;' % rec.tile_color if rec.tile_color else '#1f6abb;', 'text_color': 'color: %s;' % rec.text_color if rec.text_color else '#FFFFFF;', 'val_color': 'color: %s;' % rec.val_color if rec.val_color else '#FFFFFF;', 'icon_color': 'color: %s;' % rec.tile_color if rec.tile_color else '#1f6abb;', - 'x_pos': rec.x_pos,'y_pos': rec.y_pos, 'height': rec.height, + 'x_pos': rec.x_pos, 'y_pos': rec.y_pos, + 'height': rec.height, 'width': rec.width} domain = [] if rec.filter: @@ -131,15 +128,16 @@ class DashboardBlock(models.Model): if rec.model_name: if rec.type == 'graph': self._cr.execute(self.env[rec.model_name].get_query(domain, - rec.operation, - rec.measured_field_id, - group_by=rec.group_by_id)) + rec.operation, + rec.measured_field_id, + group_by=rec.group_by_id)) records = self._cr.dictfetchall() x_axis = [] for record in records: if record.get('name') and type( record.get('name')) == dict: - x_axis.append(record.get('name')[self._context.get('lang') or 'en_US']) + x_axis.append(record.get('name')[self._context.get( + 'lang') or 'en_US']) else: x_axis.append(record.get(rec.group_by_id.name)) y_axis = [] @@ -148,8 +146,8 @@ class DashboardBlock(models.Model): vals.update({'x_axis': x_axis, 'y_axis': y_axis}) else: self._cr.execute(self.env[rec.model_name].get_query(domain, - rec.operation, - rec.measured_field_id)) + rec.operation, + rec.measured_field_id)) records = self._cr.dictfetchall() magnitude = 0 total = records[0].get('value') @@ -164,6 +162,10 @@ class DashboardBlock(models.Model): block_id.append(vals) return block_id + @api.onchange('model_id') + def _onchange_model_id(self): + self.group_by_id = self.measured_field_id = self.filter = self.operation = '' + def get_save_layout(self, act_id, grid_data_list): """Function fetch edited values while edit layout of the chart or tile and save values in a database""" diff --git a/advanced_dynamic_dashboard/models/dashboard_menu.py b/advanced_dynamic_dashboard/models/dashboard_menu.py index 176f2c3ac..369eb9c2a 100755 --- a/advanced_dynamic_dashboard/models/dashboard_menu.py +++ b/advanced_dynamic_dashboard/models/dashboard_menu.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -################################################################################ +############################################################################# # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Robin, Afra MP (odoo@cybrosys.com) +# 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. @@ -18,7 +18,7 @@ # (AGPL v3) along with this program. # If not, see . # -################################################################################ +############################################################################# from odoo import api, fields, models @@ -61,11 +61,11 @@ class DashboardMenu(models.Model): self.env['ir.ui.menu'].search( [('parent_id', '=', rec['menu_id'].id), ('action', '=', f'ir.actions.client,{client_act_id}')]).write({ - 'name': vals['name'] if 'name' in vals.keys() else rec['name'], - 'parent_id': vals['menu_id'] if 'menu_id' in vals.keys() else - rec['menu_id'], - 'action': f'ir.actions.client,{client_act_id}' - }) + 'name': vals['name'] if 'name' in vals.keys() else rec['name'], + 'parent_id': vals['menu_id'] if 'menu_id' in vals.keys() else + rec['menu_id'], + 'action': f'ir.actions.client,{client_act_id}' + }) return super(DashboardMenu, self).write(vals) def unlink(self): diff --git a/advanced_dynamic_dashboard/models/domain_to_sql.py b/advanced_dynamic_dashboard/models/domain_to_sql.py index 2f2db20c1..1df7c1478 100755 --- a/advanced_dynamic_dashboard/models/domain_to_sql.py +++ b/advanced_dynamic_dashboard/models/domain_to_sql.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -################################################################################ +############################################################################# # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Robin, Afra MP (odoo@cybrosys.com) +# 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. @@ -18,17 +18,19 @@ # (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): +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) + data = 'COALESCE(%s("%s".%s),0) AS value' % ( + operation.upper(), self._table, field.name) join = '' group_by_str = '' if group_by: @@ -37,32 +39,30 @@ def get_query(self, args, operation, field, group_by=False, apply_ir_rules=False 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) + 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)) + group_by_str = ' Group by "%s".%s' % ( + self._table, str(group_by.name)) else: - data = '"%s".id' % (self._table) + 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' + query_str = 'SELECT %s FROM ' % data + from_clause + join + where_str + group_by_str + + def format_param(x): + if not isinstance(x, tuple): + return "'" + str(x) + "'" + elif isinstance(x, tuple) and len(x) == 1: + return "(" + str(x[0]) + ")" 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 - return query_str % tuple(map(lambda x: "'" + str(x) + "'", where_clause_params)) + return str(x) + + exact_query = query_str % tuple(map(format_param, where_clause_params)) + return exact_query models.BaseModel.get_query = get_query diff --git a/advanced_dynamic_dashboard/security/ir.model.access.csv b/advanced_dynamic_dashboard/security/ir.model.access.csv index 737b3e33b..71255d1c9 100755 --- a/advanced_dynamic_dashboard/security/ir.model.access.csv +++ b/advanced_dynamic_dashboard/security/ir.model.access.csv @@ -1,3 +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_mail,access.dashboard.mail,model_dashboard_mail,base.group_user,1,1,1,1 diff --git a/advanced_dynamic_dashboard/static/description/assets/hero.gif b/advanced_dynamic_dashboard/static/description/assets/hero.gif deleted file mode 100755 index c789c4889..000000000 Binary files a/advanced_dynamic_dashboard/static/description/assets/hero.gif and /dev/null differ diff --git a/advanced_dynamic_dashboard/static/description/assets/icons/notes.png b/advanced_dynamic_dashboard/static/description/assets/icons/notes.png new file mode 100644 index 000000000..ee5e95404 Binary files /dev/null and b/advanced_dynamic_dashboard/static/description/assets/icons/notes.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/1.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/1.png old mode 100755 new mode 100644 index cdea3a916..0cb726c13 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/1.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/1.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/10.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/10.png old mode 100755 new mode 100644 index 41853b4b8..917abe206 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/10.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/10.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/11.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/11.png old mode 100755 new mode 100644 index 780807411..0f42bd57b Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/11.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/11.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/12.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/12.png old mode 100755 new mode 100644 index 2575b1806..056741709 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/12.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/12.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/13.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/13.png old mode 100755 new mode 100644 index 57ff8e0a9..e38f92589 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/13.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/13.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/14.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/14.png old mode 100755 new mode 100644 index 53c82facc..cde7f2743 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/14.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/14.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/15.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/15.png old mode 100755 new mode 100644 index 601d3e87b..839a8ad3b Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/15.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/15.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/16.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/16.png new file mode 100644 index 000000000..617e74a95 Binary files /dev/null and b/advanced_dynamic_dashboard/static/description/assets/screenshots/16.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/17.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/17.png old mode 100755 new mode 100644 index 30e2098a2..5a5c64334 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/17.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/17.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/18.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/18.png old mode 100755 new mode 100644 index 5688a9e65..96381435b Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/18.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/18.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/2.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/2.png old mode 100755 new mode 100644 index ff3d7ace2..201480ee6 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/2.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/2.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/3.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/3.png old mode 100755 new mode 100644 index 65a66593f..b2343ad82 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/3.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/3.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/4.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/4.png old mode 100755 new mode 100644 index 5c9141bd4..f98b4c373 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/4.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/4.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/5.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/5.png old mode 100755 new mode 100644 index a4ac3b026..1dd8be2ba Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/5.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/5.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/6.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/6.png old mode 100755 new mode 100644 index 29569420a..43a7409e4 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/6.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/6.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/7.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..41b58f5c9 Binary files /dev/null and b/advanced_dynamic_dashboard/static/description/assets/screenshots/7.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/8.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/8.png old mode 100755 new mode 100644 index 3f1befe8f..1ca0422f7 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/8.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/8.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/9.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/9.png old mode 100755 new mode 100644 index 13256f0dc..3a2575ab0 Binary files a/advanced_dynamic_dashboard/static/description/assets/screenshots/9.png and b/advanced_dynamic_dashboard/static/description/assets/screenshots/9.png differ diff --git a/advanced_dynamic_dashboard/static/description/assets/screenshots/hero.png b/advanced_dynamic_dashboard/static/description/assets/screenshots/hero.png new file mode 100644 index 000000000..c9f531c35 Binary files /dev/null and b/advanced_dynamic_dashboard/static/description/assets/screenshots/hero.png differ diff --git a/advanced_dynamic_dashboard/static/description/index.html b/advanced_dynamic_dashboard/static/description/index.html index d55cb8132..124821a7c 100755 --- a/advanced_dynamic_dashboard/static/description/index.html +++ b/advanced_dynamic_dashboard/static/description/index.html @@ -3,64 +3,61 @@
-
Community
-
Enterprise
-
-
-

- Advanced Dynamic Dashboard -

-

- Detailed Advanced Dynamic Dashboard View.

-
+
+
+

+ Advanced Dynamic Dashboard +

+

+ Detailed Advanced Dynamic Dashboard View.

+
-
-

- Dynamic Dashboard module helps to Arrange the dashboard to get the information that are relevant to your - business, department, or a specific process or need. -

-
+
+

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

+
-
- -
+
+ +
- - -
@@ -68,7 +65,7 @@
- +
@@ -78,15 +75,8 @@

- KEY Highlights + KEY Highlights

-1) Easily Create Dynamic Charts and Tiles -2) Available Dark mode and Light mode -3) Create a Dynamic Dashboard Menu in Any Model -4) Charts can export into Image, PDF, and CSV -5) Drag and resize the chart and tile -6) Edit and Configure charts and tiles -
@@ -136,7 +126,7 @@

- Charts can export into Image, PDF, and CSV + Charts can export into Image, PDF, XLSX and CSV

@@ -167,8 +157,6 @@
- - @@ -176,506 +164,401 @@
-
- -
- -
- - -
-
- +
+
+ +
+
+
+
+
+

+ Screenshots +

+

+ Advanced Dynamic Dashboard for all model.

+
+
+

+ Advanced Dynamic Dashboard Menu

+

+ In Advanced Dynamic Dashboard menu you can easily add item, edit layout, change mode, print pdf, send mail to users with attachment and search item + also. +

+
+
+ +
+
+

+ Export and Delete features

+

+ Clicking on various icons generates different types of chart data, which can be exported as image, PDF, CSV, and XLSX formats. +

+
+
+ +
+

+ By clicking cross icon you can delete the Chart or Tile. +

+
+
+ +
+
+

+ Select type of the item. +

+
+
+ +
+
+

+ If selected Tile, Add a name for the tile,select model, operation type, measured field. + And also set icon and color for the tile. +

+
+
+ +
+
+

+ If selected charts, Add a name for the Chart,select model, operation type, measured field, + filters and also select the chart type, set chart size, group by(Y-axis). +

+
+
+ +
+
+

+ Edit layout. +

+

+ You can change the position of the item and resize the item. +

+
+
+ +
+
+ +
+
-
+

+ By clicking the tile, it will redirect to the corresponding tree view. +

+
+
+ +
-

- Screenshots -

-

- Advanced Dynamic Dashboard for all model.

+

+ Change the mode. +

+

+ Dark mode +

+
+
+

- Dynamic Dashboard Menu.

+ Dashboard menu +

- In dynamic dashboard menu you can easily add item, edit layout, change mode and search item - also. + You can Add dashboard menu in any module. Add a name for the menu and select the parent menu also. +

+
+
+ +
+
+ +
+
+

+ Dashboard Blocks +

+

+ You can see all the tiles and charts created in the Dashboard Block menu.

- +

- Export and Delete features.

+ Print PDF +

- By clicking 3 dots you can save chart as image and PDF formate.And also export into CSV file. + Print whole dashboard in PDF format by clicking the icon.

- +
-

- By clicking cross icon you can delete the char and tile. -

-
-
- -
-
-

- Select type of the item. -

-
-
- -
-
-

- If selected Tile, Add a name for the tile,select model, operation type, measured field. - And also set icon and color for the tile. -

-
-
- -
-
-

- If selected charts, Add a name for the Chart,select model, operation type, measured field, - filters and also select the chart type, set chart size, group by(Y-axis). -

-
-
- -
-
-

- Edit layout. -

-

- You can change the position of the item and resize the item. -

-
-
- -
-
- +
+ +
+
+

+ Send Mail +

+

+ Clicking the Mail icon brings up a wizard, where you can select users and then click the SEND button. +

+
+
+ +
+
+ +
+
+
-
- -

- By clicking the tile, it will redirect to the corresponding tree view. -

-
-
- -
-
-

- Change the mode. -

-

- Dark mode -

-
-
- -
-
-

- Dashboard menu -

-

- You can Add dashboard menu in any module. Add a name for the menu and select the parent menu also. -

-
-
-
-
- - -
- - -
- - -
- - -
-
-

- ComprehensiveMain -

-
-
-
-

- -

-
-
- Easily Create Dynamic Charts and Tiles -
-
-
-
-
-
-

- -

-
-
- Available Dark mode and Light mode -
-
-
-
-
-
-

- -

-
-
- Create a Dynamic Dashboard Menu in Any Model -
-
-
-
-
-
-

- -

-
-
- Charts can export into Image, PDF, and CSV -
+
+
+
+

+ ComprehensiveMain +

+
+
+
+

+ +

+
+
+ Easily Create Dynamic Charts and Tiles +
+
+
-
-
-
-
-

- -

-
-
- Drag and resize the chart and tile -
+
+
+

+ +

+
+
+ Available Dark mode and Light mode +
+
+
-
-
-
-
-

- -

-
-
- Edit and Configure charts and tiles -
+
+
+

+ +

+
+
+ Create a Dynamic Dashboard Menu in Any Model +
+
+
-
-
-
-
-

- -

-
-
- Available search option. -
+
+
+

+ +

+
+
+ Charts can export into Image, PDF,XLSX and CSV +
+
+
-
-
-
-
-

- -

-
-
- Available in Odoo 16.0 Community and Enterprise. -
+
+
+

+ +

+
+
+ Drag and resize the chart and tile +
+
+
-
-
-
-
-

- -

-
-
- Clickable tile. -
+
+
+

+ +

+
+
+ Edit and Configure charts and tiles +
+
+
-
-
-
-
-
- -
-
- - -
-
-

- FAQ -

-

- Advanced Dynamic Dashboard for all model.

-
-
-
-
- - -
-

- Odoo can be customized according to your business need which makes Odoo the Best ERP - Software in the market. Send us your requirements, we have a custom-tailored - solution for your business. -

-
- - -
-

- Odoo can be customized according to your business need which makes Odoo the Best ERP - Software in the market. Send us your requirements, we have a custom-tailored - solution for your business. -

-
- - -
-
-

- Odoo can be customized according to your business need which makes Odoo the Best - ERP Software in the market. Send us your requirements, we have a custom-tailored - solution for your business. -

+
+
+

+ +

+
+
+ Available search option. +
+
+
-
- - -
-
-

- Odoo can be customized according to your business need which makes Odoo the Best - ERP Software in the market. Send us your requirements, we have a custom-tailored - solution for your business. -

+
+
+

+ +

+
+
+ Print whole Dashboard in PDF format. +
+
+
-
- - -
-
-

- Odoo can be customized according to your business need which makes Odoo the Best - ERP Software in the market. Send us your requirements, we have a custom-tailored - solution for your business. -

+
+
+

+ +

+
+
+ Available in Odoo 16.0 Community and Enterprise. +
+
+
-
- - -
-
-

- Odoo can be customized according to your business need which makes Odoo the Best - ERP Software in the market. Send us your requirements, we have a custom-tailored - solution for your business. -

+
+
+

+ +

+
+
+ Clickable tile. +
+
+
-
-
-
-
- -
- -
-
-

- Video Demo -

+
-
-
-
-

Apps - Name

-

In the Gantt view, similar records will be grouped together having a link to the parent - record. There are five types of views available. They are 'Quarter Day',

-
-
-

QUICK DEMO HERE

- - - - +
+
+
+

+ RELEASE NOTES + +

+
+
+
+
+ +
+

Version 16.0.1 I Released on : 22nd March 2024 +

+

Initial commit for + advanced_dynamic_dashboard

+
-
+
- +
-
-
-

Related Modules

@@ -743,10 +626,12 @@ - - - + + + + + +
@@ -860,11 +745,7 @@ - -
- -
@@ -1042,4 +923,3 @@
- \ No newline at end of file diff --git a/advanced_dynamic_dashboard/static/src/css/dynamic_dashboard.css b/advanced_dynamic_dashboard/static/src/css/dynamic_dashboard.css index fa5c49da5..bd9d7b04d 100755 --- a/advanced_dynamic_dashboard/static/src/css/dynamic_dashboard.css +++ b/advanced_dynamic_dashboard/static/src/css/dynamic_dashboard.css @@ -14,6 +14,10 @@ transition: transform 0.2s; } +.bootbox-close-button{ + display:none; +} + .grid-stack-item { position: absolute !important; font-size: 100%; @@ -24,10 +28,6 @@ h2, h3 { font-size: 150% !important; } -.card:hover { - transform: scale(1.05); -} - .card-header { border-radius: 0.5rem 0.5rem 0 0 !important; } @@ -133,6 +133,14 @@ div.card-header { text-shadow: 2px 1px 20px #795db3; } +.modal-header .btn-close { + display: none; +} + +.modal-title{ + margin-inline-end: auto; +} + .block_setting { position: absolute; top: 7px; diff --git a/advanced_dynamic_dashboard/static/src/js/dynamic_dashboard.js b/advanced_dynamic_dashboard/static/src/js/dynamic_dashboard.js index 67d7c16ba..b91153ea3 100755 --- a/advanced_dynamic_dashboard/static/src/js/dynamic_dashboard.js +++ b/advanced_dynamic_dashboard/static/src/js/dynamic_dashboard.js @@ -11,6 +11,8 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { events: { 'click .add_block': '_onClick_add_block', 'click .block_setting': '_onClick_block_setting', + 'click .dashboard_pdf': '_onClick_dashboard_pdf', + 'click .dashboard_mail': '_onClick_create_pdf', 'click .block_delete': '_onClick_block_delete', 'click #search-button': 'search_chart', 'click #searchclear': 'clear_search', @@ -42,7 +44,6 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { this.set("title", 'Dashboard'); return this._super().then(function () { self.render_dashboards(); -// self.gridstack_init(self); }); }, fetch_data: function () {//Fetch data and call rpc query to create chart or tile. return block_ids @@ -79,6 +80,7 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { this.$el.find('.dropdown-export').toggleClass('dropdown-menu-dark', isDarkTheme); }, _onchangeFilter: function() { + // Function for changing the filter this.$('#edit_layout').show(); var start_date = $('#start-date').val(); var end_date = $('#end-date').val(); @@ -89,24 +91,14 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { if (!end_date) { end_date = "null"; } - console.log(start_date,"start") - console.log(end_date,"end") this._rpc({ model: 'dashboard.block', method: 'get_dashboard_vals', args: [[], this.action_id, start_date, end_date], }).then(function (result) { - console.log(result,"res") self.block_ids = result; self.$('.o_dynamic_dashboard').empty(); // Clear existing blocks before rendering self.render_dashboards(); // Re-render the dashboard with updated data -// var gridstack = self.$('.grid-stack').data('gridstack'); -// gridstack.enableMove(true); -// gridstack.enableResize(true); -// console.log(gridstack,"selffffffff") -// self.gridstack_init(self); -// self.gridstack_on(self); -// self.gridstack_init(self); // Reinitialize gridstack after rendering }); }, get_colors: function (x_axis) {//Function fetch random color values and set chart color @@ -206,7 +198,6 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { return [data, options]; }, gridstack_init: function (self) {// Used gridstack to drag and resize chart and tile. - console.log(self,"selfselfselfselfself") self.$('.grid-stack').gridstack({ animate: true, duration: 200, @@ -215,22 +206,15 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { handle: '.grid-stack-item-content', scroll: true }, - resizable:{ - aspectRatio:20/18, -// autoHide: false, - }, alwaysShowResizeHandle: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), float: true }); self.gridstack_off(self); }, gridstack_on: function (self) {// Enable move and resize functionality - console.log(self,"---") var gridstack = self.$('.grid-stack').data('gridstack'); - console.log(gridstack,"gridddddd") gridstack.enableMove(true); gridstack.enableResize(true); - console.log(gridstack,"selffffffff") }, gridstack_off: function (self) {// Disable move and resize functionality var gridstack = self.$('.grid-stack').data('gridstack'); @@ -238,7 +222,6 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { gridstack.enableResize(false); }, render_dashboards: function () { - console.log(this.block_ids,"prefghj") self = this; self.$("#save_layout").hide();//Hide save_layout button _.each(this.block_ids, function (block) {//Loop all chart and tile @@ -322,7 +305,6 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { var pdf = new jsPDF(); pdf.addImage(bgCanvas.toDataURL("image/png"), 'PNG', 0, 0); pdf.save(`${dataTitle}.pdf`); - } if (type === 'csv') { var rows = []; @@ -341,9 +323,44 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { var link = document.createElement("a"); link.setAttribute("href", encodeURI(csvContent)); link.setAttribute("download", `${dataTitle}.csv`); - document.body.appendChild(link); // Required for FF + document.body.appendChild(link); link.click(); } + if (type === 'xlsx'){ + var rows = []; + for (var obj of this.block_ids) { + if (obj.id == $(e.currentTarget).attr('data-id')) { + rows.push(obj.x_axis); + rows.push(obj.y_axis); + } + } + // Prepare the workbook + const workbook = new ExcelJS.Workbook(); + const worksheet = workbook.addWorksheet('My Sheet'); + for(let i = 0; i < rows.length; i++){ + worksheet.addRow(rows[i]); + } + const image = workbook.addImage({ + base64: imgData, + extension: 'png', + }); + worksheet.addImage(image, { + tl: { col: 0, row: 4 }, + ext: { width: canvas.width, height: canvas.height } + }); + // Save workbook to a file + workbook.xlsx.writeBuffer() + .then((buffer) => { + // Create a Blob object from the buffer + let blob = new Blob([buffer], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}); + let link = document.createElement('a'); + link.href = window.URL.createObjectURL(blob); + link.setAttribute("download", `${dataTitle}.xlsx`); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }) + } }, dropdown_toggle: function () {//Function to toggle the button Add Items. this.$el.find('.dropdown-addblock').toggle(); @@ -434,7 +451,6 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { location.reload() self.on_reverse_breadcrumb(); }).catch(function (error) { - console.log('Error unlinking record: ', error); }); } else { // Do nothing @@ -465,10 +481,8 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { 'default_text_color': '#FFFFFF', 'default_fa_icon': 'fa fa-bar-chart', 'default_client_action_id': parseInt(self.action_id) - }, - on_close: function () { - window.location.reload(); - } + }},{ + on_reverse_breadcrumb: this.on_reverse_breadcrumb }); } else { this.do_action({ @@ -483,26 +497,94 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { 'default_height': 5, 'default_width': 4, 'default_graph_type': chart_type, - 'default_graph_size': 'col-lg-4', 'default_fa_icon': 'fa fa-bar-chart', 'default_client_action_id': parseInt(self.action_id) - }, - on_close: function(){ - window.location.reload(); + } + }, + { + on_reverse_breadcrumb: this.on_reverse_breadcrumb + }); } - }); - } // FETCHING SAVED LAYOUT FROM LOCAL STORAGE MEMORY }, - _onClick_edit_layout: function (e) {// Function to hide edit_layout button and show save_layout button. and also work the function gridstack_on(self) - console.log(e,"oooo") + _onClick_dashboard_pdf: function (e){ + // Function for printing the pdf of the dashboard + var newElement = document.createElement('div'); + newElement.className = 'pdf'; + var parentElements = $('.grid-stack-item') + parentElements.each(function(index, parent){ + var parentWidth = $(parent).width(); + var parentHeight = $(parent).height(); + $(parent).children().first().css('width', parentWidth); + $(parent).children().first().css('height', parentHeight); + $(parent).children().first().css('margin', '10px'); + newElement.appendChild($(parent)[0].children[0]); + }) + var opt = { + margin: 8, + filename: 'Dashboard.pdf', + image: { type: 'jpeg', quality: 1 }, + html2canvas: { scale: 1 }, + jsPDF: { unit: 'mm', format: 'a3', orientation: 'portrait' } + }; + html2pdf().set(opt).from(newElement).save() + .then(()=>{ + window.location.reload() + }) + }, + _onClick_create_pdf: function(e){ + // Function for creating pdf in datauristring format + self = this; + var newElement = document.createElement('div'); + newElement.className = 'pdf'; + var parentElements = $('.grid-stack-item') + parentElements.each(function(index, parent){ + var parentWidth = $(parent).width(); + var parentHeight = $(parent).height(); + $(parent).children().first().css('width', parentWidth); + $(parent).children().first().css('height', parentHeight); + $(parent).children().first().css('margin', '10px'); + newElement.appendChild($(parent)[0].children[0]); + }) + var opt = { + margin: 0.3, + filename: 'Dashboard.pdf', + image: { type: 'jpeg', quality: 1 }, + html2canvas: { scale: 1 }, + jsPDF: { unit: 'mm', format: 'a3', orientation: 'portrait' } + }; + var pdf = html2pdf().set(opt).from(newElement).toPdf().output('datauristring') + .then(function(pdfOutput) { + self.dashboard_mail(pdfOutput) + }) + }, + + dashboard_mail: function(pdfData){ + // Function for sending mail to the selected users + var base64code = pdfData.split(',')[1]; + self.do_action({ + type: 'ir.actions.act_window', + name: 'SEND MAIL', + res_model: 'dashboard.mail', + view_mode: 'form', + views: [[false, 'form']], + target: 'new', + context: { + 'default_base64code': base64code, + } + }); + }, + + _onClick_edit_layout: function (e) { + // Function to hide edit_layout button and show save_layout button. and also work the function gridstack_on(self) e.stopPropagation(); self = this; self.$("#edit_layout").hide(); self.$("#save_layout").show(); self.gridstack_on(self); }, - _onClick_save_layout: function (e) {//Function to save the edited value + _onClick_save_layout: function (e) { + //Function to save the edited value e.stopPropagation(); self = this; self.$("#edit_layout").show(); @@ -524,7 +606,8 @@ odoo.define('advanced_dynamic_dashboard.Dashboard', function (require) { }); self.gridstack_off(self); }, - _onClick_tile: function (e) {// Function to view the tree view of the tile. + _onClick_tile: function (e) { + // Function to view the tree view of the tile. e.stopPropagation(); self = this; ajax.jsonRpc('/tile/details', 'call', { diff --git a/advanced_dynamic_dashboard/static/src/xml/dynamic_dashboard_template.xml b/advanced_dynamic_dashboard/static/src/xml/dynamic_dashboard_template.xml index b6a06d625..0699dbd81 100755 --- a/advanced_dynamic_dashboard/static/src/xml/dynamic_dashboard_template.xml +++ b/advanced_dynamic_dashboard/static/src/xml/dynamic_dashboard_template.xml @@ -22,7 +22,6 @@ aria-expanded="false"> ⠀Add Items - -