@ -0,0 +1,50 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
PSQL Query Execute |
||||
|
================== |
||||
|
* PSQL Query Execute module helps to execute PSQL queries in the Odoo user interface. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* The menu Psql Query lies inside the Technical menu of the Settings |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (LGPL v3). |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developer: (V16) Gion Dany |
||||
|
(V17) Anjhana A K |
||||
|
(V18) Abbas P |
||||
|
|
||||
|
Contact: odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit https://www.cybrosys.com |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
||||
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Abbas P(<https://www.cybrosys.com>) |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# 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 AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import controllers |
||||
|
from . import models |
||||
@ -0,0 +1,46 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Abbas P(<https://www.cybrosys.com>) |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# 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 AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': "PSQL Query Execute", |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Extra Tools', |
||||
|
'summary': """Odoo18 PSQL Query Execute, Run the PSQL query in the Odoo user interface.""", |
||||
|
'description': """PSQL Query Execute, SQL, PSQL, psql, query, odoo query, query run, database,""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com', |
||||
|
'depends': ['base', 'mail'], |
||||
|
'data': [ |
||||
|
'security/ir.model.access.csv', |
||||
|
'views/psql_query_views.xml' |
||||
|
], |
||||
|
'assets': { |
||||
|
'web.assets_backend': [ |
||||
|
'psql_query_execute/static/src/js/action_manager.js', |
||||
|
], |
||||
|
}, |
||||
|
'images': ['static/description/banner.png'], |
||||
|
'license': "LGPL-3", |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Abbas P(<https://www.cybrosys.com>) |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# 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 AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import psql_query_execute |
||||
@ -0,0 +1,55 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Abbas P(<https://www.cybrosys.com>) |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# 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 AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
import json |
||||
|
from odoo import http |
||||
|
from odoo.http import content_disposition, request, serialize_exception |
||||
|
from odoo.tools import html_escape |
||||
|
|
||||
|
|
||||
|
class XLSXReportController(http.Controller): |
||||
|
"""Xlsx Report controller""" |
||||
|
@http.route('/xlsx_reports', type='http', auth='user', methods=['POST'], |
||||
|
csrf=False) |
||||
|
def get_report_xlsx(self, model, options, output_format, report_name): |
||||
|
"""xlsx report""" |
||||
|
report_obj = request.env[model].with_user(request.session.uid) |
||||
|
options = json.loads(options) |
||||
|
token = 'dummy-because-api-expects-one' |
||||
|
try: |
||||
|
if output_format == 'xlsx': |
||||
|
response = request.make_response( |
||||
|
None, |
||||
|
headers=[ |
||||
|
('Content-Type', 'application/vnd.ms-excel'), |
||||
|
('Content-Disposition', content_disposition(report_name + '.xlsx')) |
||||
|
] |
||||
|
) |
||||
|
report_obj.get_xlsx_report(options, response) |
||||
|
response.set_cookie('fileToken', token) |
||||
|
return response |
||||
|
except Exception as e: |
||||
|
se = serialize_exception(e) |
||||
|
error = { |
||||
|
'code': 200, |
||||
|
'message': 'Odoo Server Error', |
||||
|
'data': se |
||||
|
} |
||||
|
return request.make_response(html_escape(json.dumps(error))) |
||||
@ -0,0 +1,6 @@ |
|||||
|
## Module <psql_query_execute> |
||||
|
|
||||
|
#### 15.02.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
#### ADD |
||||
|
- Initial commit for PSQL Query Execute |
||||
@ -0,0 +1,21 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Abbas P(<https://www.cybrosys.com>) |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# 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 AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import psql_query |
||||
@ -0,0 +1,157 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Abbas P(<https://www.cybrosys.com>) |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# 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 AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
import json |
||||
|
import io |
||||
|
from odoo import fields, models, _ |
||||
|
from odoo.tools import date_utils, json_default |
||||
|
from odoo.exceptions import ValidationError |
||||
|
|
||||
|
try: |
||||
|
from odoo.tools.misc import xlsxwriter |
||||
|
except ImportError: |
||||
|
import xlsxwriter |
||||
|
|
||||
|
|
||||
|
class PsqlQuery(models.Model): |
||||
|
""" This model executes a query directly in the Odoo user interface. """ |
||||
|
_name = 'psql.query' |
||||
|
_description = 'PostgreSQL Query' |
||||
|
_inherit = ['mail.thread', 'mail.activity.mixin'] |
||||
|
|
||||
|
name = fields.Char(string='Name', required=True, help="Query Name") |
||||
|
query_name = fields.Text(string='Query', required=True, |
||||
|
help="Type the query to execute") |
||||
|
query_result = fields.Html(string='Result', readonly=True, |
||||
|
help="Data output of the query") |
||||
|
|
||||
|
def action_execute_query(self): |
||||
|
"""Execute the query operation""" |
||||
|
try: |
||||
|
if self.query_name: |
||||
|
self._cr.execute(self.query_name) |
||||
|
keys = [i[0] for i in self._cr.description] |
||||
|
table_header = '' |
||||
|
table_datas = '' |
||||
|
for key in keys: |
||||
|
table_header += ( |
||||
|
"<th style='border:1px solid black !important'>%s" |
||||
|
"</th>" % key) |
||||
|
query_result = self._cr.fetchall() |
||||
|
for query_res in query_result: |
||||
|
table_datas += "<tr>" |
||||
|
for res in query_res: |
||||
|
table_datas += ( |
||||
|
"<td style='border:1px solid black !important'>{0}" |
||||
|
"</td>".format(res)) |
||||
|
table_datas += "</tr>" |
||||
|
self.query_result = """<div style="overflow:auto;"> |
||||
|
<table class="table text-center table-border table-sm" |
||||
|
style="width:max-content";><thead> |
||||
|
<tr style='border:1px solid black |
||||
|
!important;background: lightblue;'> |
||||
|
""" + str(table_header) + """</tr></thead><tbody> |
||||
|
""" + str(table_datas) + """</tbody></table> |
||||
|
</div>""" |
||||
|
except Exception as error: |
||||
|
raise ValidationError(_('Error executing SQL query: %s ', error)) |
||||
|
|
||||
|
def _get_report_data(self): |
||||
|
"""Get the value of the data for which the query was executed""" |
||||
|
today = fields.Datetime.now().date() |
||||
|
result = [] |
||||
|
keys = '' |
||||
|
try: |
||||
|
if self.query_name: |
||||
|
self._cr.execute(self.query_name) |
||||
|
keys = [i[0] for i in self._cr.description] |
||||
|
for data in self._cr.fetchall(): |
||||
|
result.append(data) |
||||
|
except Exception as error: |
||||
|
raise ValidationError(_('Error executing SQL query: %s ', error)) |
||||
|
datas = { |
||||
|
'ids': self, |
||||
|
'model': 'psql.query', |
||||
|
'no_value': False, |
||||
|
'header': keys, |
||||
|
'form': result, |
||||
|
'date': today, |
||||
|
} |
||||
|
return datas |
||||
|
|
||||
|
def action_print_query_result_xlsx(self): |
||||
|
"""Print the query result in Xlsx report""" |
||||
|
data = self._get_report_data() |
||||
|
return { |
||||
|
'type': 'ir.actions.report', |
||||
|
'report_type': 'xlsx', |
||||
|
'data': {'model': 'psql.query', |
||||
|
'output_format': 'xlsx', |
||||
|
'options': json.dumps(data, default=json_default), |
||||
|
'report_name': 'Query Report', |
||||
|
}, |
||||
|
} |
||||
|
|
||||
|
def get_xlsx_report(self, data, response): |
||||
|
"""Generate and return an XLSX report.""" |
||||
|
output = io.BytesIO() |
||||
|
workbook = xlsxwriter.Workbook(output, {'in_memory': True}) |
||||
|
sheet = workbook.add_worksheet() |
||||
|
sheet.set_default_row(19) |
||||
|
|
||||
|
cmp_name = self.env.user.company_id.name or '' |
||||
|
txt_1 = workbook.add_format( |
||||
|
{'font_size': '10px', 'bold': True, 'align': 'center', 'color': '#423642'} |
||||
|
) |
||||
|
|
||||
|
date_now = data.get('date', '') |
||||
|
sheet.merge_range('A1:B1', f'Report Date: {date_now}', txt_1) |
||||
|
sheet.merge_range('A2:B2', cmp_name, txt_1) |
||||
|
|
||||
|
format1 = workbook.add_format({'font_size': 10, 'align': 'center', 'bg_color': '#edd8ed', 'border': 1}) |
||||
|
format3 = workbook.add_format( |
||||
|
{'font_size': 10, 'align': 'center', 'bold': True, 'bg_color': '#edd8ed', 'border': 1}) |
||||
|
|
||||
|
# Write headers |
||||
|
row_number = 4 |
||||
|
column_number = 0 |
||||
|
record = data.get('header', []) |
||||
|
for row in record: |
||||
|
sheet.merge_range(row_number - 1, column_number, row_number, column_number, row, format3) |
||||
|
column_number += 1 |
||||
|
|
||||
|
# Write data rows |
||||
|
row_number = 5 |
||||
|
for val in data.get('form', []): |
||||
|
column_number = 0 |
||||
|
for values in val: |
||||
|
if isinstance(values, dict): |
||||
|
values = str(values) # Convert dictionary to string or extract key if needed |
||||
|
elif values is None: |
||||
|
values = 'None' |
||||
|
sheet.write(row_number, column_number, values, format1) |
||||
|
sheet.set_column(column_number, column_number, 15) |
||||
|
column_number += 1 |
||||
|
row_number += 1 |
||||
|
|
||||
|
workbook.close() |
||||
|
output.seek(0) |
||||
|
response.stream.write(output.read()) |
||||
|
output.close() |
||||
|
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 628 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 209 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 495 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 624 B |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 214 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 310 B |
|
After Width: | Height: | Size: 929 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 542 B |
|
After Width: | Height: | Size: 576 B |
|
After Width: | Height: | Size: 733 B |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 307 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 911 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 600 B |
|
After Width: | Height: | Size: 673 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 926 B |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 878 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 653 B |
|
After Width: | Height: | Size: 800 B |
|
After Width: | Height: | Size: 905 B |
|
After Width: | Height: | Size: 189 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 839 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 427 B |
|
After Width: | Height: | Size: 627 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 988 B |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 875 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 767 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 760 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 697 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 880 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 17 KiB |
@ -0,0 +1,24 @@ |
|||||
|
/** @odoo-module **/ |
||||
|
import { registry } from "@web/core/registry"; |
||||
|
import { BlockUI } from "@web/core/ui/block_ui"; |
||||
|
import { download } from "@web/core/network/download"; |
||||
|
/** |
||||
|
XLSX Handler |
||||
|
This handler is responsible for generating XLSX reports. |
||||
|
It sends a request to the server to generate the report in XLSX format |
||||
|
and downloads the generated file. |
||||
|
@param {Object} action - The action object containing the report details. |
||||
|
@returns {Promise} - A promise that resolves when the report generation is complete. |
||||
|
*/ |
||||
|
registry.category("ir.actions.report handlers").add("xlsx", async function (action) { |
||||
|
if (action.report_type === 'xlsx') { |
||||
|
BlockUI; |
||||
|
await download({ |
||||
|
url: '/xlsx_reports', |
||||
|
data: action.data, |
||||
|
complete: () => unblockUI, |
||||
|
error: (error) => self.call('crash_manager', 'rpc_error', error), |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
}); |
||||
@ -0,0 +1,67 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- PSQL Query form view --> |
||||
|
<record id="psql_query_view_form" model="ir.ui.view"> |
||||
|
<field name="name">psql.query.view.form</field> |
||||
|
<field name="model">psql.query</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="PostgreSQL Query"> |
||||
|
<sheet> |
||||
|
<div class="oe_title"> |
||||
|
<h1> |
||||
|
<field name="name" placeholder="Query Name"/> |
||||
|
</h1> |
||||
|
</div> |
||||
|
<group/> |
||||
|
<h2> |
||||
|
<field name="query_name" placeholder="Type the query to execute"/> |
||||
|
</h2> |
||||
|
<div style="margin-bottom: 46px;"> |
||||
|
<button name="action_execute_query" |
||||
|
string="Execute/Refresh" |
||||
|
type="object" |
||||
|
class="fa fa-play btn btn-primary" style="font-size: 10px;"/> |
||||
|
</div> |
||||
|
<div style="font-size: 15px; font-weight: bold; margin-bottom: 10px;">Result:</div> |
||||
|
<div style="overflow: scroll"> |
||||
|
<group> |
||||
|
<field name="query_result" type="html" class="oe_memo" default_focus="1" string="" |
||||
|
options="{'resizable': false, 'collaborative': true}"/> |
||||
|
</group> |
||||
|
</div> |
||||
|
<group/> |
||||
|
<div style="margin-top: 46px;display: flex; justify-content: center;"> |
||||
|
<button name="action_print_query_result_xlsx" string="XLSX" type="object" |
||||
|
class="fa fa-file-excel-o btn btn-primary"/> |
||||
|
</div> |
||||
|
</sheet> |
||||
|
<chatter/> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- PSQL Query tree view --> |
||||
|
<record id="psql_query_view_tree" model="ir.ui.view"> |
||||
|
<field name="name">psql.query.view.tree</field> |
||||
|
<field name="model">psql.query</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<list string="PostgreSQL Query"> |
||||
|
<field name="name"/> |
||||
|
<field name="query_name"/> |
||||
|
</list> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- PSQL Query action --> |
||||
|
<record id="action_psql_query" model="ir.actions.act_window"> |
||||
|
<field name="name">PostgreSQL Query</field> |
||||
|
<field name="type">ir.actions.act_window</field> |
||||
|
<field name="res_model">psql.query</field> |
||||
|
<field name="view_mode">list,form</field> |
||||
|
<field name="help" type="html"> |
||||
|
<p class="o_view_nocontent_smiling_face"> |
||||
|
Execute PSQL Query |
||||
|
</p> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- Menus for PSQL Query --> |
||||
|
<menuitem id="psql_query_root" name="PSQL Query" parent="base.next_id_9" action="action_psql_query" sequence="15"/> |
||||
|
</odoo> |
||||