jul 29 2025

Merge branch 'develop'
This commit is contained in:
administrator 2025-07-29 17:58:24 +05:30
commit 5581c9f524
146 changed files with 8504 additions and 0 deletions

View File

@ -0,0 +1,7 @@
from . import models
from odoo.api import Environment, SUPERUSER_ID
def ks_dna_uninstall_hook(env):
for rec in env['ks_dashboard_ninja.item'].search([]):
if rec.ks_data_calculation_type == 'query':
rec.unlink()

View File

@ -0,0 +1,142 @@
# -*- coding: utf-8 -*-
{
'name': 'Advanced Dashboard Ninja with AI',
'summary': """
Dashboard Ninja Advance for Odoo allows you to showcase your complex data in
form of interactive and engaging charts or list views. Manage the complicated data of
your business and get a detailed insight into your sale. Dashboard Ninja Advance,
Dashboard Ninja, Modern Odoo Dashboards, Powerful Dashboard, Beautiful Dashboard,
Modern Dashboard, Chart Dashboard, Graph Dashboard, Pie Chart Dashboard, Ninja Dashboard.
""",
'description': """
Best Odoo Dashboard Apps
Slider Dashboard Apps
Odoo Query Dashboard Apps
Display Dashboard Apps
All in One Dashboard
TV Dashboard Apps
List View Layout
Dashboards item Slider
Full Screen Dashboard Item
TV View Dashboard
Custom Database View
Complex Data Dashboard
Different Models Dashboard
Multi Models Data
Custom Report Dashboard
Multi Report Dashboard
Complex Data Item
Slider Report
Multiple Table in Single Dashboard
Bulk Data in Single Dashboard
Graph View Dashboard Apps
Pie Chart Dashboard Apps
Widget View Dashboard
Best Odoo Apps
Dashboard For Websites
Odoo Dashboard apps
Dashboard apps
Dashboards for Websites
HR Dashboard Apps
Sales Dashboard Apps
inventory Dashboard Apps
Lead Dashboards
Opportunity Dashboards
CRM Dashboards
Best POS Apps
POS Dashboards
Web Dynamic Apps,
Report Import/Export,
Date Filter Apps
Tile Dashboard Apps
Dashboard Widgets,
Dashboard Manager Apps,
Debranding Apps
Customize Dashboard Apps
Charts Dashboard Apps
Invoice Dashboard Apps
Project management Apps
Visualization charts
Finance Dashboard
Accounting Report
Accounting Valuation
Accounting Quantities
Dashboard for Odoo
Accounting Metrics
Expense Dashboard Apps
Invoicing Dashboard
Vendor Payable Report
Stock management System
Purchase Order Dashboards
Sales Order Dashboards
Stock Alert Apps
Inventory Alert Apps
Product Dashboard
Sales Dashboard
Best Dashboard Apps
Inventory Report
Inventory Valuation
Inventory Quantities
V14 Dashboard
Dashboard v14.0,
Odoo Dashboard v14.0
New Odoo Dashboard Apps
Dashboard Ninja Advance
""",
'author': 'Pranay',
'website': 'https://ftprotech.in/',
'maintainer': 'FTPROTECH',
'category': 'Services',
'version': '18.0.1.0.1',
'support': 'sales@ksolves.com',
'images': ['static/description/Dashboard ninja advance banner.gif'],
'depends': ['ks_dashboard_ninja', 'mail'],
'external_dependencies': {'python': ['mysql-connector']},
'data': ['security/ir.model.access.csv',
'views/ks_dashboard_ninja_item_view_inherit.xml',
'views/ks_dashboard_form_view_inherit.xml',
'views/ks_mail_template.xml'],
'module_type': 'official',
'images': ['static/description/Dashboard ninja advance banner.gif'],
'assets': {'web.assets_backend': [
'ks_dn_advance/static/src/scss/carousel.scss',
'ks_dn_advance/static/src/css/ks_tv_dashboard.css',
'ks_dn_advance/static/lib/css/owl.carousel.min.css',
'ks_dn_advance/static/src/js/ks_labels.js',
'ks_dn_advance/static/src/js/ks_ylabels.js',
#
'ks_dn_advance/static/src/js/ks_dashboard_ninja_tv_list_preview.js',
'ks_dn_advance/static/src/js/carousel.js',
'ks_dn_advance/static/src/js/play_modal.js',
'ks_dn_advance/static/src/js/ks_advance_dashboard.js',
'ks_dn_advance/static/description/js/jquery.slim.min.js',
'ks_dn_advance/static/lib/js/owl.carousel.min.js',
'ks_dn_advance/static/src/xml/**/*'],
'web.assets_frontend': [
'ks_dn_advance/static/src/css/ks_tv_dashboard.css',
],
'web.assets_qweb': ['ks_dn_advance/static/src/xml/**/*']},
'uninstall_hook': 'ks_dna_uninstall_hook',
}

View File

@ -0,0 +1,345 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ks_dn_advance
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-26 15:37+0000\n"
"PO-Revision-Date: 2021-05-26 15:37+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: ks_dn_advance
#: model:ir.model.fields,help:ks_dn_advance.field_ks_dashboard_ninja_item__ks_is_date_ranges
msgid ""
" Checkbox to apply default date range filter. The date filter applied will "
"also reflect on the main page."
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,help:ks_dn_advance.field_ks_dashboard_ninja_item__ks_custom_query
msgid " Fetch, combine, and compare data by generating SQL query on your own."
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_board__ks_croessel_speed__60000
msgid "1 minute"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_board__ks_croessel_speed__10000
msgid "10 Seconds"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_board__ks_croessel_speed__15000
msgid "15 Seconds"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_board__ks_croessel_speed__3000
msgid "3 Seconds"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_board__ks_croessel_speed__30000
msgid "30 Seconds"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_board__ks_croessel_speed__45000
msgid "45 Seconds"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_board__ks_croessel_speed__5000
msgid "5 Seconds"
msgstr ""
#. module: ks_dn_advance
#. openerp-web
#: code:addons/ks_dn_advance/static/src/xml/ks_query_templates.xml:0
#, python-format
msgid "Chart Type"
msgstr ""
#. module: ks_dn_advance
#: code:addons/ks_dn_advance/models/ks_dashboard_advance_ninja.py:0
#: code:addons/ks_dn_advance/models/ks_dashboard_advance_ninja.py:0
#: code:addons/ks_dn_advance/models/ks_dashboard_advance_ninja.py:0
#, python-format
msgid ""
"Current Json File is not properly formatted according to Dashboard Ninja "
"Model."
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__ks_custom_query
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_item__ks_data_calculation_type__query
msgid "Custom Query"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model,name:ks_dn_advance.model_ks_dashboard_ninja_board
msgid "Dashboard Ninja"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model,name:ks_dn_advance.model_ks_dashboard_ninja_item
msgid "Dashboard Ninja items"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__ks_data_calculation_type
msgid "Data Calculation Type"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,help:ks_dn_advance.field_ks_dashboard_ninja_item__ks_model_id
msgid ""
"Data source to fetch and read the data for the creation of dashboard items. "
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__ks_is_date_ranges
msgid "Date Ranges"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_item__ks_data_calculation_type__custom
msgid "Default Query"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_item__ks_list_view_layout__layout_1
msgid "Default layout"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_board__display_name
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__display_name
msgid "Display Name"
msgstr ""
#. module: ks_dn_advance
#. openerp-web
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#, python-format
msgid "Drill Up"
msgstr ""
#. module: ks_dn_advance
#: model_terms:ir.ui.view,arch_db:ks_dn_advance.item_form_inherit
msgid "End Date"
msgstr ""
#. module: ks_dn_advance
#: model_terms:ir.ui.view,arch_db:ks_dn_advance.item_quick_edit_form_inherit
msgid "Fields to show in list"
msgstr ""
#. module: ks_dn_advance
#. openerp-web
#: code:addons/ks_dn_advance/static/src/xml/ks_query_templates.xml:0
#, python-format
msgid "Group"
msgstr ""
#. module: ks_dn_advance
#: model_terms:ir.ui.view,arch_db:ks_dn_advance.item_quick_edit_form_inherit
msgid "Group By"
msgstr ""
#. module: ks_dn_advance
#: model_terms:ir.ui.view,arch_db:ks_dn_advance.item_quick_edit_form_inherit
msgid "Group By Date"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_board__id
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__id
msgid "ID"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__ks_query_end_date
msgid "Ks Query End Date"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__ks_query_start_date
msgid "Ks Query Start Date"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_board____last_update
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item____last_update
msgid "Last Modified on"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_item__ks_list_view_layout__layout_2
msgid "Layout 1"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_item__ks_list_view_layout__layout_3
msgid "Layout 2"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields.selection,name:ks_dn_advance.selection__ks_dashboard_ninja_item__ks_list_view_layout__layout_4
msgid "Layout 3"
msgstr ""
#. module: ks_dn_advance
#: model_terms:ir.ui.view,arch_db:ks_dn_advance.item_quick_edit_form_inherit
msgid "Line Measure"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__ks_list_view_layout
msgid "List View Layout"
msgstr ""
#. module: ks_dn_advance
#. openerp-web
#: code:addons/ks_dn_advance/static/src/xml/ks_query_templates.xml:0
#: model_terms:ir.ui.view,arch_db:ks_dn_advance.item_quick_edit_form_inherit
#, python-format
msgid "Measures"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__ks_model_id
msgid "Model"
msgstr ""
#. module: ks_dn_advance
#. openerp-web
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#, python-format
msgid "No Data Present"
msgstr ""
#. module: ks_dn_advance
#. openerp-web
#: code:addons/ks_dn_advance/static/src/xml/ks_dna_to_template.xml:0
#, python-format
msgid "No Section Available."
msgstr ""
#. module: ks_dn_advance
#. openerp-web
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#, python-format
msgid "Play"
msgstr ""
#. module: ks_dn_advance
#: code:addons/ks_dn_advance/models/ks_dashboard_advance_ninja.py:0
#, python-format
msgid ""
"Please Install the Module which contains the following Model : %s "
"ks_model_id"
msgstr ""
#. module: ks_dn_advance
#: model_terms:ir.ui.view,arch_db:ks_dn_advance.item_form_inherit
msgid "Query"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__ks_query_result
msgid "Result"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,help:ks_dn_advance.field_ks_dashboard_ninja_item__ks_data_calculation_type
msgid "Select the type of calculation you want to perform on the data."
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_board__ks_croessel_speed
msgid "Slide Interval"
msgstr ""
#. module: ks_dn_advance
#. openerp-web
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#: code:addons/ks_dn_advance/static/src/xml/ks_dashboard_tv_ninja.xml:0
#, python-format
msgid "Sort button"
msgstr ""
#. module: ks_dn_advance
#: model_terms:ir.ui.view,arch_db:ks_dn_advance.item_form_inherit
msgid "Start Date"
msgstr ""
#. module: ks_dn_advance
#: code:addons/ks_dn_advance/models/ks_dashboard_advance_ninja_item.py:0
#, python-format
msgid "Start Date should be less than End Date"
msgstr ""
#. module: ks_dn_advance
#: code:addons/ks_dn_advance/models/ks_dashboard_advance_ninja.py:0
#, python-format
msgid "This file is not supported"
msgstr ""
#. module: ks_dn_advance
#: code:addons/ks_dn_advance/models/ks_dashboard_advance_ninja_item.py:0
#: code:addons/ks_dn_advance/models/ks_dashboard_advance_ninja_item.py:0
#, python-format
msgid ""
"Wrong date variables, Please use ks_start_date and ks_end_date in custom "
"query"
msgstr ""
#. module: ks_dn_advance
#: model_terms:ir.ui.view,arch_db:ks_dn_advance.item_form_inherit
msgid "X-Label"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__ks_xlabels
msgid "X-Labels"
msgstr ""
#. module: ks_dn_advance
#: model_terms:ir.ui.view,arch_db:ks_dn_advance.item_form_inherit
msgid "Y-Axis"
msgstr ""
#. module: ks_dn_advance
#: model:ir.model.fields,field_description:ks_dn_advance.field_ks_dashboard_ninja_item__ks_ylabels
msgid "Y-Labels"
msgstr ""
#. module: ks_dn_advance
#: code:addons/ks_dn_advance/models/ks_dashboard_advance_ninja_item.py:0
#: code:addons/ks_dn_advance/models/ks_dashboard_advance_ninja_item.py:0
#, python-format
msgid "You can only read the Data from Database"
msgstr ""

View File

@ -0,0 +1,2 @@
from . import ks_dashboard_advance_ninja
from . import ks_dashboard_advance_ninja_item

View File

@ -0,0 +1,303 @@
from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
from odoo.exceptions import ValidationError
from odoo import models, fields, api, _
from odoo.tools.safe_eval import safe_eval
import traceback
import logging
import datetime
import json
_logger = logging.getLogger(__name__)
class KsDashboardNinjaAdvance(models.Model):
_inherit = "ks_dashboard_ninja.board"
ks_croessel_speed = fields.Selection([('3000', '3 Seconds'),
('5000', '5 Seconds'),
('10000', '10 Seconds'),
('15000', '15 Seconds'),
('30000', '30 Seconds'),
('45000', '45 Seconds'),
('60000', '1 minute'),
], string="Slide Interval", default = '5000')
ks_mail_to_partner = fields.Many2one('res.partner', string='Email To', domain=[('email', '!=', False)])
ks_mail_to_cc_partner = fields.Many2many('res.partner', 'res_partner_dashboard_ninja', 'partner_id', 'board_id',
domain=[('email', '!=', False)], string='Email Cc')
ks_mail_email_cc_value = fields.Text(string='Email CC Value')
def ks_fetch_item_data(self, rec, params={}):
item = super(KsDashboardNinjaAdvance, self).ks_fetch_item_data(rec, params)
item["ks_data_calculation_type"] = rec.ks_data_calculation_type
item['ks_list_view_layout'] = rec.ks_list_view_layout
item['ks_is_external_api']= rec.ks_is_external_api
item['ks_url']= rec.ks_url
item['ks_api_header'] = rec.ks_api_header
# item['data_source'] = rec.data_source
return item
def ks_export_item_data(self, rec):
item = super(KsDashboardNinjaAdvance, self).ks_export_item_data(rec)
item['ks_data_calculation_type'] = rec.ks_data_calculation_type
item['ks_custom_query'] = rec.ks_custom_query
item['ks_xlabels'] = rec.ks_xlabels
item['ks_ylabels'] = rec.ks_ylabels
item['ks_list_view_layout'] = rec.ks_list_view_layout
item['ks_is_date_ranges'] = rec.ks_is_date_ranges
item['ks_query_start_date'] = rec.ks_query_start_date.strftime(
DEFAULT_SERVER_DATETIME_FORMAT) if rec.ks_query_start_date else False
item['ks_query_end_date'] = rec.ks_query_end_date.strftime(
DEFAULT_SERVER_DATETIME_FORMAT) if rec.ks_query_end_date else False
item['ks_is_external_db'] = rec.ks_is_external_db
item['ks_host'] = rec.ks_host
item['ks_port'] = rec.ks_port
item['ks_db_name'] = rec.ks_db_name
item['ks_db_password'] =rec.ks_db_password
item['ks_db_user']=rec.ks_db_user
item['ks_external_db_type'] = rec.ks_external_db_type
ks_api_data_lines = []
for res in rec.ks_api_data_lines:
ks_api_data_line = {
'name': res.name,
'ttype': res.ttype,
'ks_dashboard_datatype_id': rec.id,
}
ks_api_data_lines.append(ks_api_data_line)
item['ks_is_external_api']= rec.ks_is_external_api
item['ks_url'] = rec.ks_url
item['ks_api_header'] = rec.ks_api_header
# item['data_source'] = rec.data_source
item['ks_api_data_lines'] = ks_api_data_lines if ks_api_data_lines else False
return item
@api.model
def ks_fetch_dashboard_data(self,ks_dashboard_id, ks_item_domain=False):
dashboard_data = super(KsDashboardNinjaAdvance, self).ks_fetch_dashboard_data(ks_dashboard_id, ks_item_domain)
dashboard_data['ks_croessel_speed'] = self.browse(ks_dashboard_id).ks_croessel_speed
return dashboard_data
def ks_create_item(self, item):
if item.get('ks_data_calculation_type', False) == 'custom':
model = self.env['ir.model'].search([('model', '=', item['ks_model_id'])])
if not model and not item['ks_dashboard_item_type'] == 'ks_to_do':
raise ValidationError(_(
"Please Install the Module which contains the following Model : %s " % item['ks_model_id']))
ks_model_name = item['ks_model_id']
ks_goal_lines = item['ks_goal_liness'].copy() if item.get('ks_goal_liness', False) else False
ks_action_lines = item['ks_action_liness'].copy() if item.get('ks_action_liness', False) else False
ks_dn_header_line = item['ks_dn_header_line'].copy() if item.get('ks_dn_header_line', False) else False
ks_multiplier_lines = item['ks_multiplier_lines'].copy() if item.get('ks_multiplier_lines', False) else False
ks_api_data_lines = item['ks_api_data_lines'].copy() if item.get('ks_api_data_lines', False) else False
# Creating dashboard items
item = self.ks_prepare_item(item)
if 'ks_goal_liness' in item:
del item['ks_goal_liness']
if 'ks_id' in item:
del item['ks_id']
if 'ks_action_liness' in item:
del item['ks_action_liness']
if 'ks_icon' in item:
item['ks_icon_select'] = "Default"
item['ks_icon'] = False
if 'ks_dn_header_line' in item:
del item['ks_dn_header_line']
if 'ks_multiplier_lines' in item:
del item['ks_multiplier_lines']
if 'ks_api_data_lines' in item:
del item['ks_api_data_lines']
ks_item = self.env['ks_dashboard_ninja.item'].create(item)
if ks_goal_lines and len(ks_goal_lines) != 0:
for line in ks_goal_lines:
line['ks_goal_date'] = datetime.datetime.strptime(line['ks_goal_date'].split(" ")[0],
'%Y-%m-%d')
line['ks_dashboard_item'] = ks_item.id
self.env['ks_dashboard_ninja.item_goal'].create(line)
if ks_dn_header_line and len(ks_dn_header_line) != 0:
for line in ks_dn_header_line:
ks_line = {}
ks_line['ks_to_do_header'] = line.get('ks_to_do_header')
ks_line['ks_dn_item_id'] = ks_item.id
ks_dn_header_id = self.env['ks_to.do.headers'].create(ks_line)
if line.get(line.get('ks_to_do_header'), False):
for ks_task in line.get(line.get('ks_to_do_header')):
ks_task['ks_to_do_header_id'] = ks_dn_header_id.id
self.env['ks_to.do.description'].create(ks_task)
if ks_action_lines and len(ks_action_lines) != 0:
for line in ks_action_lines:
if line['ks_sort_by_field']:
ks_sort_by_field = line['ks_sort_by_field']
ks_sort_record_id = self.env['ir.model.fields'].search(
[('model', '=', ks_model_name), ('name', '=', ks_sort_by_field)])
if ks_sort_record_id:
line['ks_sort_by_field'] = ks_sort_record_id.id
else:
line['ks_sort_by_field'] = False
if line['ks_item_action_field']:
ks_item_action_field = line['ks_item_action_field']
ks_record_id = self.env['ir.model.fields'].search(
[('model', '=', ks_model_name), ('name', '=', ks_item_action_field)])
if ks_record_id:
line['ks_item_action_field'] = ks_record_id.id
line['ks_dashboard_item_id'] = ks_item.id
self.env['ks_dashboard_ninja.item_action'].create(line)
if ks_multiplier_lines and len(ks_multiplier_lines) != 0:
for rec in ks_multiplier_lines:
ks_multiplier_field = rec['ks_multiplier_fields']
ks_multiplier_field_id = self.env['ir.model.fields'].search([('model', '=', ks_model_name), ('id', '=', ks_multiplier_field)])
if ks_multiplier_field:
rec['ks_multiplier_fields'] = ks_multiplier_field_id.id
rec['ks_dashboard_item_id'] = ks_item.id
self.env['ks_dashboard_item.multiplier'].create(rec)
if ks_api_data_lines and len(ks_api_data_lines) != 0:
for rec in ks_api_data_lines:
rec['ks_dashboard_datatype_id'] = ks_item.id
self.env['ks.dashboard.api'].create(rec)
return ks_item
@api.model
def ks_import_dashboard(self, file, menu_id):
try:
# ks_dashboard_data = json.loads(file)
ks_dashboard_file_read = json.loads(file)
except:
raise ValidationError(_("This file is not supported"))
if 'ks_file_format' in ks_dashboard_file_read and ks_dashboard_file_read[
'ks_file_format'] == 'ks_dashboard_ninja_export_file':
ks_dashboard_data = ks_dashboard_file_read['ks_dashboard_data']
for i in range(len(ks_dashboard_data)):
if 'ks_set_interval' in ks_dashboard_data[i].keys() and ks_dashboard_data[i].get('ks_item_data', False):
# del ks_dashboard_data[i]['ks_set_interval']
for j in range(len(ks_dashboard_data[i].get('ks_item_data', False))):
if 'ks_update_items_data' in ks_dashboard_data[i].get('ks_item_data', False)[j].keys():
del ks_dashboard_data[i].get('ks_item_data', False)[j]['ks_update_items_data']
if 'ks_auto_update_type' in ks_dashboard_data[i].get('ks_item_data', False)[j].keys():
del ks_dashboard_data[i].get('ks_item_data', False)[j]['ks_auto_update_type']
if 'ks_show_live_pop_up' in ks_dashboard_data[i].get('ks_item_data', False)[j].keys():
del ks_dashboard_data[i].get('ks_item_data', False)[j]['ks_show_live_pop_up']
else:
raise ValidationError(_("Current Json File is not properly formatted according to Dashboard Ninja Model."))
ks_dashboard_key = ['name', 'ks_dashboard_menu_name', 'ks_gridstack_config']
ks_dashboard_item_key = ['ks_model_id', 'ks_chart_measure_field', 'ks_list_view_fields', 'ks_record_field',
'ks_chart_relation_groupby', 'ks_id']
# Fetching dashboard model info
for data in ks_dashboard_data:
if not all(key in data for key in ks_dashboard_key):
raise ValidationError(
_("Current Json File is not properly formatted according to Dashboard Ninja Model."))
ks_dashboard_top_menu_id = data.get('ks_dashboard_top_menu_id', False)
if ks_dashboard_top_menu_id:
try:
self.env['ir.ui.menu'].browse(ks_dashboard_top_menu_id).name
ks_dashboard_top_menu_id = self.env['ir.ui.menu'].browse(ks_dashboard_top_menu_id)
except Exception:
ks_dashboard_top_menu_id = False
vals = self.ks_prepare_import_data_vals(data, menu_id)
# Creating Dashboard
dashboard_id = self.create(vals)
if data['ks_gridstack_config']:
ks_gridstack_config = safe_eval(data['ks_gridstack_config'])
ks_grid_stack_config = {}
item_ids = []
item_new_ids = []
if data['ks_item_data']:
# Fetching dashboard item info
for item in data['ks_item_data']:
item['ks_company_id'] = False
if not all(key in item for key in ks_dashboard_item_key):
raise ValidationError(
_("Current Json File is not properly formatted according to Dashboard Ninja Model."))
# Creating dashboard items
item['ks_dashboard_ninja_board_id'] = dashboard_id.id
item_ids.append(item['ks_id'])
del item['ks_id']
ks_item = self.ks_create_item(item)
item_new_ids.append(ks_item.id)
for id_index, id in enumerate(item_ids):
if data['ks_gridstack_config'] and str(id) in ks_gridstack_config:
ks_grid_stack_config[str(item_new_ids[id_index])] = ks_gridstack_config[str(id)]
self.browse(dashboard_id.id).write({
'ks_gridstack_config': json.dumps(ks_grid_stack_config)
})
return "Success"
# separate function to make item for import
def ks_dashboard_send_mail(self, file):
ks_mail_validate = self.ks_email_validation()
if ks_mail_validate:
try:
pdf_b64 = file
attachment = {
'name': str(self.name),
'datas': pdf_b64,
'res_model': 'ks_dashboard_ninja_board',
'type': 'binary',
'mimetype': 'application/pdf',
}
self.env.user
ks_attachment = self.env['ir.attachment'].create(attachment)
ks_mail_template = self.env.ref('ks_dn_advance.ks_mail_templates')
ks_mail_template.attachment_ids = [(6, 0, [ks_attachment.id])]
ks_ctx = {'ks_report_name': self.name if self.name else "My Dashboard"}
if ks_mail_template:
try:
ks_mail_template.with_context(ks_ctx).send_mail(self.id, force_send=True)
return {'ks_is_send': True,
'ks_massage': _("Email has been sent")
}
except Exception as e:
_logger.error(traceback.format_exc())
return {'ks_is_send': False,
'ks_massage': _("Email has not been sent.Please check your console log")
}
except Exception as e:
return {'ks_is_send': False,
'ks_massage': _("Email has not been sent.Please check your console log.")
}
_logger.error(traceback.format_exc())
else:
return {'ks_is_send': False,
'ks_massage': _("Please fill the email to form the dashboard configuration")
}
def ks_email_validation(self):
if not self.ks_mail_to_partner:
# raise ValidationError()
return False
else:
return True
@api.onchange('ks_mail_to_cc_partner')
def onchange_ks_mail_to_cc_partner(self):
ks_user_mails = ''
for partner in self.ks_mail_to_cc_partner:
ks_user_mails += partner.email + ' ' + ','
self.ks_mail_email_cc_value = ks_user_mails

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
mysql-connector==2.2.9

View File

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_ks_dashboard_api,ks.dashboard.api,model_ks_dashboard_api,,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_ks_dashboard_api ks.dashboard.api model_ks_dashboard_api 1 1 1 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -0,0 +1,3 @@
<svg width="14" height="8" viewBox="0 0 14 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1L7 7L13 1" stroke="#4B4B4B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM6.75 14.14C6.75 14.55 6.41 14.89 6 14.89C5.59 14.89 5.25 14.55 5.25 14.14V9.86C5.25 9.45 5.59 9.11 6 9.11C6.41 9.11 6.75 9.45 6.75 9.86V14.14ZM9.75 15.57C9.75 15.98 9.41 16.32 9 16.32C8.59 16.32 8.25 15.98 8.25 15.57V8.43C8.25 8.02 8.59 7.68 9 7.68C9.41 7.68 9.75 8.02 9.75 8.43V15.57ZM12.75 17C12.75 17.41 12.41 17.75 12 17.75C11.59 17.75 11.25 17.41 11.25 17V7C11.25 6.59 11.59 6.25 12 6.25C12.41 6.25 12.75 6.59 12.75 7V17ZM15.75 15.57C15.75 15.98 15.41 16.32 15 16.32C14.59 16.32 14.25 15.98 14.25 15.57V8.43C14.25 8.02 14.59 7.68 15 7.68C15.41 7.68 15.75 8.02 15.75 8.43V15.57ZM18.75 14.14C18.75 14.55 18.41 14.89 18 14.89C17.59 14.89 17.25 14.55 17.25 14.14V9.86C17.25 9.45 17.59 9.11 18 9.11C18.41 9.11 18.75 9.45 18.75 9.86V14.14Z" fill="#737791"/>
</svg>

After

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Some files were not shown because too many files have changed in this diff Show More