diff --git a/polars_db_process/README.rst b/polars_db_process/README.rst index a97389ad00..d65cebec6d 100644 --- a/polars_db_process/README.rst +++ b/polars_db_process/README.rst @@ -67,6 +67,13 @@ Authors * Akretion +Contributors +------------ + +- Akretion + + - David BEAL + Maintainers ----------- diff --git a/polars_db_process/__manifest__.py b/polars_db_process/__manifest__.py index 280c36f879..1294d6101a 100644 --- a/polars_db_process/__manifest__.py +++ b/polars_db_process/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Polars Database Process", "version": "18.0.1.0.0", - "summary": "Allow to create a Polars dataframe from database query and " + "summary": "Allow to create a Polars dataframe from db.query and " "check it and process it according to rules", "category": "Reporting", "license": "AGPL-3", @@ -20,11 +20,17 @@ ] }, "data": [ - "data/demo.xml", + "security/ir.model.access.xml", "wizards/df_process.xml", "views/dataframe.xml", "views/df_field.xml", "views/df_source.xml", + "views/db_config.xml", + # "views/db_table.xml", + # "views/db_type.xml", + ], + "demo": [ + "data/demo.xml", ], "installable": True, } diff --git a/polars_db_process/models/__init__.py b/polars_db_process/models/__init__.py index c613e94135..fce9b99e02 100644 --- a/polars_db_process/models/__init__.py +++ b/polars_db_process/models/__init__.py @@ -1,3 +1,4 @@ from . import dataframe from . import df_field from . import df_source +from . import db_config diff --git a/polars_db_process/models/db_config.py b/polars_db_process/models/db_config.py new file mode 100644 index 0000000000..eb65074938 --- /dev/null +++ b/polars_db_process/models/db_config.py @@ -0,0 +1,23 @@ +from odoo import fields, models + +HELP = """ +String connexion samples: + +postgres://user:PASSWORD@server:port/database +mssql://user:PASSWORD@server:port/db.encrypt=true&trusted_connection=false +sqlite:///home/user/path/test.db +mysql://user:PASSWORD@server:port/database +oracle://user:PASSWORD@server:port/database +""" + + +class DatabaseConfig(models.Model): + _name = "db.config" + _description = "External db.configuration" + + name = fields.Char(required=True) + string_connexion = fields.Char(required=True, help=HELP) + password = fields.Char(required=True) + + def _get_connexion(self): + return self.string_connexion.replace("PASSWORD", self.password) diff --git a/polars_db_process/models/df_source.py b/polars_db_process/models/df_source.py index 1bb4a10f92..57303b3873 100644 --- a/polars_db_process/models/df_source.py +++ b/polars_db_process/models/df_source.py @@ -1,5 +1,8 @@ -from odoo import models +from odoo import fields, models class DfSource(models.Model): _inherit = "df.source" + + query = fields.Char() + db_id = fields.Many2one(comodel_name="db.config", help="Database") diff --git a/polars_db_process/readme/CONTRIBUTORS.md b/polars_db_process/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..a388703b6d --- /dev/null +++ b/polars_db_process/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Akretion + + > - David BEAL \<\> diff --git a/polars_db_process/security/ir.model.access.xml b/polars_db_process/security/ir.model.access.xml new file mode 100644 index 0000000000..9cc3d07de0 --- /dev/null +++ b/polars_db_process/security/ir.model.access.xml @@ -0,0 +1,11 @@ + + + Database Config + + + + + + + + diff --git a/polars_db_process/static/description/index.html b/polars_db_process/static/description/index.html index 3d01fe5687..523f13953d 100644 --- a/polars_db_process/static/description/index.html +++ b/polars_db_process/static/description/index.html @@ -391,7 +391,8 @@

Polars Database Process

  • Bug Tracker
  • Credits
  • @@ -412,8 +413,20 @@

    Authors

  • Akretion
  • +
    +

    Contributors

    + +
    -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association diff --git a/polars_db_process/views/db_config.xml b/polars_db_process/views/db_config.xml new file mode 100644 index 0000000000..f4d64ad45c --- /dev/null +++ b/polars_db_process/views/db_config.xml @@ -0,0 +1,53 @@ + + + db.config + +
    +
    + + + + + + + + + + + +
    + PASSWORD in string connexion'll be replaced by password field +
    +
    +
    + + + + + + db.config + + + + + + + + + Database Config + db.config + list,form + db-config + + + + diff --git a/polars_db_process/views/df_source.xml b/polars_db_process/views/df_source.xml index 2385074797..623a488640 100644 --- a/polars_db_process/views/df_source.xml +++ b/polars_db_process/views/df_source.xml @@ -1 +1,48 @@ - + + + df.source + + + + + + + + + + + + + + df.source + + + + + + + {'accepted_file_extensions': '.xlsx,.sql'} + + + + + + df.source + + + + + + + + + + + diff --git a/polars_db_process/wizards/df_process.py b/polars_db_process/wizards/df_process.py index 21eb91a631..ddfbed51f0 100644 --- a/polars_db_process/wizards/df_process.py +++ b/polars_db_process/wizards/df_process.py @@ -5,3 +5,6 @@ class DfProcessWiz(models.TransientModel): _inherit = "df.process.wiz" + + # def _pre_process(self): + # super()._pre_process() diff --git a/test-requirement.txt b/test-requirement.txt index 073dc5a6ce..61712502d4 100644 --- a/test-requirement.txt +++ b/test-requirement.txt @@ -1 +1 @@ -odoo-addon-polars_process @ git+https://github.com/OCA/reporting-engine.git@refs/pull/943/head#subdirectory=polars_process \ No newline at end of file +odoo-addon-polars_process @ git+https://github.com/OCA/reporting-engine.git@refs/pull/943/head#subdirectory=polars_process