diff --git a/sql_request_abstract/README.rst b/sql_request_abstract/README.rst index 53b07da7c..16df145e9 100644 --- a/sql_request_abstract/README.rst +++ b/sql_request_abstract/README.rst @@ -17,37 +17,40 @@ SQL Request Abstract :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github - :target: https://github.com/OCA/reporting-engine/tree/16.0/sql_request_abstract + :target: https://github.com/OCA/reporting-engine/tree/17.0/sql_request_abstract :alt: OCA/reporting-engine .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-sql_request_abstract + :target: https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-sql_request_abstract :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -This module provides an abstract model to manage SQL Select requests on database. -It is not usefull for itself. You can see an exemple of implementation in the -'sql_export' module. (same repository). +This module provides an abstract model to manage SQL Select requests on +database. It is not usefull for itself. You can see an exemple of +implementation in the 'sql_export' module. (same repository). Implemented features -~~~~~~~~~~~~~~~~~~~~ +-------------------- -* Add some restrictions in the sql request: - * you can only read datas. No update, deletion or creation are possible. - * some tables are not allowed, because they could contains clear password - or keys. For the time being ('ir_config_parameter'). +- Add some restrictions in the sql request: -* The request can be in a 'draft' or a 'SQL Valid' status. To be valid, - the request has to be cleaned, checked and tested. All of this operations - can be disabled in the inherited modules. + - you can only read datas. No update, deletion or creation are + possible. + - some tables are not allowed, because they could contains clear + password or keys. For the time being ('ir_config_parameter'). -* This module two new groups: - * SQL Request / User : Can see all the sql requests by default and execute - them, if they are valid. - * SQL Request / Manager : has full access on sql requests. +- The request can be in a 'draft' or a 'SQL Valid' status. To be valid, + the request has to be cleaned, checked and tested. All of this + operations can be disabled in the inherited modules. + +- This module two new groups: + + - SQL Request / User : Can see all the sql requests by default and + execute them, if they are valid. + - SQL Request / Manager : has full access on sql requests. **Table of contents** @@ -59,27 +62,27 @@ Usage Inherit the model: -.. code-block:: python +.. code:: python - from odoo import models + from odoo import models - class MyModel(models.model) - _name = 'my.model' - _inherit = ['sql.request.mixin'] + class MyModel(models.model) + _name = 'my.model' + _inherit = ['sql.request.mixin'] - _sql_request_groups_relation = 'my_model_groups_rel' + _sql_request_groups_relation = 'my_model_groups_rel' - _sql_request_users_relation = 'my_model_users_rel' + _sql_request_users_relation = 'my_model_users_rel' - -See implementations in the modules ``bi_sql_editor`` and ``sql_export``. (same OCA/reporting-engine repository) +See implementations in the modules ``bi_sql_editor`` and ``sql_export``. +(same OCA/reporting-engine repository) Development =========== -This module add the 'pgsql' mode syntax for the ace widget. -(the ace widget is used in odoo web module, but only with -the xml and python mode). +This module add the 'pgsql' mode syntax for the ace widget. (the ace +widget is used in odoo web module, but only with the xml and python +mode). The file is a copy of the file present here (https://github.com/ajaxorg/ace-builds/blob/v1.12.3/src/mode-pgsql.js @@ -91,7 +94,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -99,21 +102,22 @@ Credits ======= Authors -~~~~~~~ +------- * GRAP * Akretion Contributors -~~~~~~~~~~~~ +------------ -* Florian da Costa -* Sylvain LE GAL (https://twitter.com/legalsylvain) -* Alfadil Tabar (alfadil.tabar@gmail.com) -* Helly kapatel +- Florian da Costa +- Sylvain LE GAL (https://twitter.com/legalsylvain) +- Alfadil Tabar (alfadil.tabar@gmail.com) +- Helly kapatel +- Nguyen Minh Chien Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -133,6 +137,6 @@ Current `maintainer `__: |maintainer-legalsylvain| -This module is part of the `OCA/reporting-engine `_ project on GitHub. +This module is part of the `OCA/reporting-engine `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sql_request_abstract/__init__.py b/sql_request_abstract/__init__.py index 91c5580fe..0650744f6 100644 --- a/sql_request_abstract/__init__.py +++ b/sql_request_abstract/__init__.py @@ -1,2 +1 @@ -from . import controllers from . import models diff --git a/sql_request_abstract/__manifest__.py b/sql_request_abstract/__manifest__.py index 17ca71f6c..1140fb1dd 100644 --- a/sql_request_abstract/__manifest__.py +++ b/sql_request_abstract/__manifest__.py @@ -4,7 +4,7 @@ { "name": "SQL Request Abstract", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "author": "GRAP,Akretion,Odoo Community Association (OCA)", "maintainers": ["legalsylvain"], "website": "https://github.com/OCA/reporting-engine", @@ -18,5 +18,13 @@ "security/ir.model.access.csv", "views/view_sql_request_mixin.xml", ], + "assets": { + "web._assets_core": [ + "sql_request_abstract/static/src/js/code_editor.esm.js", + ], + "web.ace_lib": [ + "sql_request_abstract/static/lib/ace/mode-pgsql.js", + ], + }, "installable": True, } diff --git a/sql_request_abstract/controllers/__init__.py b/sql_request_abstract/controllers/__init__.py deleted file mode 100644 index 12a7e529b..000000000 --- a/sql_request_abstract/controllers/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import main diff --git a/sql_request_abstract/controllers/main.py b/sql_request_abstract/controllers/main.py deleted file mode 100644 index 57f3c1fc7..000000000 --- a/sql_request_abstract/controllers/main.py +++ /dev/null @@ -1,28 +0,0 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -import werkzeug - -from odoo import http -from odoo.http import request -from odoo.tools.misc import file_open - -from odoo.addons.web.controllers.webclient import WebClient - - -class SqlRequestAbstractWebClient(WebClient): - # if a field, widget="ace" option="{'mode': 'xxx'}" - # is present, The ace lib (odoo/addons/web/static/lib/ace) - # will generate a call to /web/static/lib/ace/mode-xxx.js - # to load the javascript syntax file. - # We catch this call and redirect on the correct path - @http.route("/web/static/lib/ace/mode-pgsql.js", type="http", auth="none") - def call_mode_pgsql_file(self): - return http.Response( - werkzeug.wsgi.wrap_file( - request.httprequest.environ, - file_open("sql_request_abstract/static/lib/ace/mode-pgsql.js", "rb"), - ), - content_type="application/javascript; charset=utf-8", - headers=[("Cache-Control", f"max-age={http.STATIC_CACHE}")], - direct_passthrough=True, - ) diff --git a/sql_request_abstract/readme/CONTRIBUTORS.md b/sql_request_abstract/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..908f292d8 --- /dev/null +++ b/sql_request_abstract/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- Florian da Costa \<\> +- Sylvain LE GAL () +- Alfadil Tabar () +- Helly kapatel \<\> +- Nguyen Minh Chien \<\> diff --git a/sql_request_abstract/readme/CONTRIBUTORS.rst b/sql_request_abstract/readme/CONTRIBUTORS.rst deleted file mode 100644 index bd9d2ba21..000000000 --- a/sql_request_abstract/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,4 +0,0 @@ -* Florian da Costa -* Sylvain LE GAL (https://twitter.com/legalsylvain) -* Alfadil Tabar (alfadil.tabar@gmail.com) -* Helly kapatel diff --git a/sql_request_abstract/readme/DESCRIPTION.md b/sql_request_abstract/readme/DESCRIPTION.md new file mode 100644 index 000000000..18c554646 --- /dev/null +++ b/sql_request_abstract/readme/DESCRIPTION.md @@ -0,0 +1,20 @@ +This module provides an abstract model to manage SQL Select requests on +database. It is not usefull for itself. You can see an exemple of +implementation in the 'sql_export' module. (same repository). + +## Implemented features + +- Add some restrictions in the sql request: + - you can only read datas. No update, deletion or creation are + possible. + - some tables are not allowed, because they could contains clear + password or keys. For the time being ('ir_config_parameter'). + +- The request can be in a 'draft' or a 'SQL Valid' status. To be valid, + the request has to be cleaned, checked and tested. All of this + operations can be disabled in the inherited modules. + +- This module two new groups: + - SQL Request / User : Can see all the sql requests by default and + execute them, if they are valid. + - SQL Request / Manager : has full access on sql requests. diff --git a/sql_request_abstract/readme/DESCRIPTION.rst b/sql_request_abstract/readme/DESCRIPTION.rst deleted file mode 100644 index 9ea482990..000000000 --- a/sql_request_abstract/readme/DESCRIPTION.rst +++ /dev/null @@ -1,20 +0,0 @@ -This module provides an abstract model to manage SQL Select requests on database. -It is not usefull for itself. You can see an exemple of implementation in the -'sql_export' module. (same repository). - -Implemented features -~~~~~~~~~~~~~~~~~~~~ - -* Add some restrictions in the sql request: - * you can only read datas. No update, deletion or creation are possible. - * some tables are not allowed, because they could contains clear password - or keys. For the time being ('ir_config_parameter'). - -* The request can be in a 'draft' or a 'SQL Valid' status. To be valid, - the request has to be cleaned, checked and tested. All of this operations - can be disabled in the inherited modules. - -* This module two new groups: - * SQL Request / User : Can see all the sql requests by default and execute - them, if they are valid. - * SQL Request / Manager : has full access on sql requests. diff --git a/sql_request_abstract/readme/DEVELOP.md b/sql_request_abstract/readme/DEVELOP.md new file mode 100644 index 000000000..df8ca301e --- /dev/null +++ b/sql_request_abstract/readme/DEVELOP.md @@ -0,0 +1,7 @@ +This module add the 'pgsql' mode syntax for the ace widget. (the ace +widget is used in odoo web module, but only with the xml and python +mode). + +The file is a copy of the file present here +( +(Release 18 Oct 2022) diff --git a/sql_request_abstract/readme/DEVELOP.rst b/sql_request_abstract/readme/DEVELOP.rst deleted file mode 100644 index 4f668a5fa..000000000 --- a/sql_request_abstract/readme/DEVELOP.rst +++ /dev/null @@ -1,7 +0,0 @@ -This module add the 'pgsql' mode syntax for the ace widget. -(the ace widget is used in odoo web module, but only with -the xml and python mode). - -The file is a copy of the file present here -(https://github.com/ajaxorg/ace-builds/blob/v1.12.3/src/mode-pgsql.js -(Release 18 Oct 2022) diff --git a/sql_request_abstract/readme/USAGE.md b/sql_request_abstract/readme/USAGE.md new file mode 100644 index 000000000..1cddf1f14 --- /dev/null +++ b/sql_request_abstract/readme/USAGE.md @@ -0,0 +1,16 @@ +Inherit the model: + +``` python +from odoo import models + +class MyModel(models.model) + _name = 'my.model' + _inherit = ['sql.request.mixin'] + + _sql_request_groups_relation = 'my_model_groups_rel' + + _sql_request_users_relation = 'my_model_users_rel' +``` + +See implementations in the modules `bi_sql_editor` and `sql_export`. +(same OCA/reporting-engine repository) diff --git a/sql_request_abstract/readme/USAGE.rst b/sql_request_abstract/readme/USAGE.rst deleted file mode 100644 index 17319aacc..000000000 --- a/sql_request_abstract/readme/USAGE.rst +++ /dev/null @@ -1,16 +0,0 @@ -Inherit the model: - -.. code-block:: python - - from odoo import models - - class MyModel(models.model) - _name = 'my.model' - _inherit = ['sql.request.mixin'] - - _sql_request_groups_relation = 'my_model_groups_rel' - - _sql_request_users_relation = 'my_model_users_rel' - - -See implementations in the modules ``bi_sql_editor`` and ``sql_export``. (same OCA/reporting-engine repository) diff --git a/sql_request_abstract/static/description/index.html b/sql_request_abstract/static/description/index.html index 552dfa434..8af9916a1 100644 --- a/sql_request_abstract/static/description/index.html +++ b/sql_request_abstract/static/description/index.html @@ -1,4 +1,3 @@ - @@ -369,35 +368,28 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:e65a56914d10ae27bb307f92fe00fa9c00a67f0842a1227a7a2a869c1847a166 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

-

This module provides an abstract model to manage SQL Select requests on database. -It is not usefull for itself. You can see an exemple of implementation in the -‘sql_export’ module. (same repository).

+

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

+

This module provides an abstract model to manage SQL Select requests on +database. It is not usefull for itself. You can see an exemple of +implementation in the ‘sql_export’ module. (same repository).

Implemented features

    -
  • -
    Add some restrictions in the sql request:
    -
      -
    • you can only read datas. No update, deletion or creation are possible.
    • -
    • some tables are not allowed, because they could contains clear password -or keys. For the time being (‘ir_config_parameter’).
    • +
    • Add some restrictions in the sql request:
        +
      • you can only read datas. No update, deletion or creation are +possible.
      • +
      • some tables are not allowed, because they could contains clear +password or keys. For the time being (‘ir_config_parameter’).
      -
    -
  • The request can be in a ‘draft’ or a ‘SQL Valid’ status. To be valid, -the request has to be cleaned, checked and tested. All of this operations -can be disabled in the inherited modules.
  • -
  • -
    This module two new groups:
    -
      -
    • SQL Request / User : Can see all the sql requests by default and execute -them, if they are valid.
    • +the request has to be cleaned, checked and tested. All of this +operations can be disabled in the inherited modules. +
    • This module two new groups:
        +
      • SQL Request / User : Can see all the sql requests by default and +execute them, if they are valid.
      • SQL Request / Manager : has full access on sql requests.
      -
    -

Table of contents

@@ -423,13 +415,14 @@ them, if they are valid. _sql_request_users_relation = 'my_model_users_rel' -

See implementations in the modules bi_sql_editor and sql_export. (same OCA/reporting-engine repository)

+

See implementations in the modules bi_sql_editor and sql_export. +(same OCA/reporting-engine repository)

Development

-

This module add the ‘pgsql’ mode syntax for the ace widget. -(the ace widget is used in odoo web module, but only with -the xml and python mode).

+

This module add the ‘pgsql’ mode syntax for the ace widget. (the ace +widget is used in odoo web module, but only with the xml and python +mode).

The file is a copy of the file present here (https://github.com/ajaxorg/ace-builds/blob/v1.12.3/src/mode-pgsql.js (Release 18 Oct 2022)

@@ -439,7 +432,7 @@ the xml and python mode).

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -460,6 +453,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
  • Sylvain LE GAL (https://twitter.com/legalsylvain)
  • Alfadil Tabar (alfadil.tabar@gmail.com)
  • Helly kapatel <helly.kapatel@initos.com>
  • +
  • Nguyen Minh Chien <chien@trobz.com>
  • @@ -471,7 +465,7 @@ mission is to support the collaborative development of Odoo features and promote its widespread use.

    Current maintainer:

    legalsylvain

    -

    This module is part of the OCA/reporting-engine project on GitHub.

    +

    This module is part of the OCA/reporting-engine project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/sql_request_abstract/static/src/js/code_editor.esm.js b/sql_request_abstract/static/src/js/code_editor.esm.js new file mode 100644 index 000000000..d738cc548 --- /dev/null +++ b/sql_request_abstract/static/src/js/code_editor.esm.js @@ -0,0 +1,8 @@ +/** @odoo-module **/ + +import {CodeEditor} from "@web/core/code_editor/code_editor"; +import {patch} from "@web/core/utils/patch"; + +patch(CodeEditor, { + MODES: [...CodeEditor.MODES, "pgsql"], +}); diff --git a/sql_request_abstract/views/view_sql_request_mixin.xml b/sql_request_abstract/views/view_sql_request_mixin.xml index 8def067b0..ea8c37a3b 100644 --- a/sql_request_abstract/views/view_sql_request_mixin.xml +++ b/sql_request_abstract/views/view_sql_request_mixin.xml @@ -27,7 +27,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).