Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
5fabbb4
Add sql export module (migration from v7)
florian-dacosta Feb 5, 2016
bf2ab7c
[IMP] add support of variables in queries
bguillot May 23, 2016
21a9b84
[MIG] Migrate module from 8.0 to 9.0
mourad-ehm Aug 30, 2016
59bbdc9
[REF] create a new module sql_request_abstract
legalsylvain Feb 22, 2017
f9d1e60
Fix version
florian-dacosta Mar 6, 2017
a9d309e
[IMP]encode output file
AaronHForgeFlow Mar 14, 2017
52d71f9
[FIX] various improvement. Courtesy @dreispt review
legalsylvain Apr 18, 2017
1834a15
OCA Transbot updated translations from Transifex
oca-transbot Jun 10, 2017
dabf0ca
[MIG][10.0]sql_export v10
AaronHForgeFlow Nov 10, 2017
555c6f5
[FIX] mogrify doesn't allow dicts
MiquelRForgeFlow Jun 25, 2018
65d573a
[UPD] Update sql_export.pot
oca-travis Jun 27, 2018
62daa65
Translated using Weblate (German)
rschnapka Sep 6, 2018
7cdacf5
IMP Readme for Sql Export Module
bealdav Oct 16, 2018
02b595f
Update translation files
oca-transbot Nov 25, 2018
3f86fe0
PORT v12 sql_export
bealdav Apr 8, 2019
a52c021
FIX sql_export: test and misc
bealdav Apr 9, 2019
161fd19
[UPD] Update sql_export.pot
oca-travis Apr 19, 2019
7f0f94a
[FIX] title level in readme fragments
sbidoul May 11, 2019
f5cc593
[UPD] README.rst
OCA-git-bot May 11, 2019
c475613
Update translation files
oca-transbot May 20, 2019
15fe7ef
IMP sql_export: render field as require when matching field def
bealdav May 22, 2019
a03f438
Fix uses of params in sql query
florian-dacosta Jun 20, 2019
b0bf8a4
[UPD] README.rst
OCA-git-bot Jul 29, 2019
9f3df75
Adapt module sql_export_mail to be compatible with multiple file format
florian-dacosta Aug 21, 2019
dc65baf
Translated using Weblate (Chinese (Simplified))
liweijie0812 Aug 31, 2019
6d9b244
Migrate sql_export_excel to v12
florian-dacosta Sep 2, 2019
31f85a6
Translated using Weblate (Portuguese (Brazil))
Sep 2, 2019
50e94e6
Small fixes for v12/python3 standard
florian-dacosta Sep 3, 2019
6ee50e1
[UPD] Update sql_export.pot
oca-travis Aug 28, 2020
24d52d6
Update translation files
oca-transbot Aug 28, 2020
20a0e90
[UPD] Update sql_export.pot
oca-travis Nov 10, 2020
065f3a7
sql_export 12.0.1.1.0
OCA-git-bot Nov 10, 2020
c26b534
Update translation files
oca-transbot Nov 10, 2020
eadc2af
[FIX] sql_export: fix warning two fields have same label
fernandahf Dec 16, 2020
7dbbbfd
[UPD] Update sql_export.pot
oca-travis Dec 16, 2020
fdca58d
sql_export 12.0.1.1.1
OCA-git-bot Dec 16, 2020
245ac48
Update translation files
oca-transbot Dec 16, 2020
333bccf
[IMP] sql_export: black, isort, prettier
florian-dacosta Mar 22, 2021
102fddb
Migrate to 14.0
florian-dacosta Mar 22, 2021
75a8934
Update roadmap for v15 and make some usability improvements
florian-dacosta May 20, 2021
8ba303b
[UPD] Update sql_export.pot
oca-travis May 22, 2021
c9530ce
[UPD] README.rst
OCA-git-bot May 22, 2021
5a3b72a
[PORT] 14.0 port #2061 : sql_export : add preview button
legalsylvain Apr 2, 2021
94dcf86
[UPD] Update sql_export.pot
oca-travis Jul 28, 2021
c6bfb45
sql_export 14.0.1.1.0
OCA-git-bot Jul 28, 2021
466ea6f
Update translation files
oca-transbot Jul 28, 2021
10cf7d4
[UPD] Update sql_export.pot
oca-travis Sep 2, 2021
23c5db2
Update translation files
oca-transbot Sep 2, 2021
eada404
[IMP] sql_export: black, isort, prettier
mariadforgeflow Dec 2, 2021
c79b330
[MIG] sql_export: Migration to 15.0
mariadforgeflow Dec 2, 2021
bbdc95e
[UPD] Update sql_export.pot
Feb 1, 2022
63d5d12
[UPD] README.rst
OCA-git-bot Feb 1, 2022
2acdeb9
Translated using Weblate (Catalan)
jabelchi Jun 15, 2022
c8ad9aa
[IMP] sql_export: black, isort, prettier
legalsylvain Oct 26, 2022
a70ff1a
[MIG] sql_export from V15.0
legalsylvain Oct 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup/sql_export/odoo/addons/sql_export
6 changes: 6 additions & 0 deletions setup/sql_export/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
118 changes: 118 additions & 0 deletions sql_export/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
==========
SQL Export
==========

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
: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/15.0/sql_export
: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-15-0/reporting-engine-15-0-sql_export
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/143/15.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

Allow to export data in csv files FROM sql requests.
There are some restrictions in the sql query, you can only read datas.
No update, deletion or creation are possible.
A new menu named Export is created.

**Table of contents**

.. contents::
:local:

Usage
=====


Dashboards > Sql Export


**Specific use with parameters**

- `%(company_id)s` allows to set in the query the company id of the user
- `%(user_id)s` allows to set in the query the user id
- for any created field with `Sql Export Variables` menu, you can use it with `%(x_field_example)s` syntax
(Limitation for relational fields)

Known issues / Roadmap
======================

* Some words are prohibited and can't be used is the query in anyways, even in
a select query:
- delete
- drop
- insert
- alter
- truncate
- execute
- create
- update

See sql_request_abstract module to fix this issue.

* checking SQL request by execution and rollback is disabled in this module
since variables features has been introduced. This can be fixed by
overloading _prepare_request_check_execution() function.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20sql_export%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Akretion

Contributors
~~~~~~~~~~~~

* `Akretion <https://www.akretion.com>`_:

* Florian da Costa <florian.dacosta@akretion.com>
* Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
* Benoît GUILLOT <benoit.guillot@akretion.com>

* `Eficent <https://www.eficent.com>`_:

* Aaron Henriquez <ahenriquez@eficent.com>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/15.0/sql_export>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions sql_export/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizard
30 changes: 30 additions & 0 deletions sql_export/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2015 Akretion (<http://www.akretion.com>)
# @author: Florian da Costa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "SQL Export",
"version": "16.0.1.0.0",
"author": "Akretion,GRAP,Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"website": "https://github.com/OCA/reporting-engine",
"license": "AGPL-3",
"category": "Generic Modules/Others",
"summary": "Export data in csv file with SQL requests",
"depends": [
"spreadsheet_dashboard",
"sql_request_abstract",
],
"data": [
"views/sql_export_view.xml",
"views/ir_model_fields_view.xml",
"wizard/wizard_file_view.xml",
"security/sql_export_security.xml",
"security/ir.model.access.csv",
],
"demo": [
"demo/ir_model_fields.xml",
"demo/sql_export.xml",
],
"installable": True,
}
37 changes: 37 additions & 0 deletions sql_export/demo/ir_model_fields.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
@author Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record id="date_field_variable_sql" model="ir.model.fields">
<field name="name">x_date</field>
<field name="field_description">Date</field>
<field name="ttype">date</field>
<field name="model_id" ref="sql_export.model_sql_file_wizard" />
<field name="model">sql.file.wizard</field>
<field name="state">manual</field>
</record>

<record id="integer_field_variable_sql" model="ir.model.fields">
<field name="name">x_id</field>
<field name="field_description">x_ID</field>
<field name="ttype">integer</field>
<field name="model_id" ref="sql_export.model_sql_file_wizard" />
<field name="model">sql.file.wizard</field>
<field name="state">manual</field>
</record>

<record id="m2m_field_variable_sql" model="ir.model.fields">
<field name="name">x_partner_categ_ids</field>
<field name="field_description">Partner Categories</field>
<field name="ttype">many2many</field>
<field name="model_id" ref="sql_export.model_sql_file_wizard" />
<field name="model">sql.file.wizard</field>
<field name="state">manual</field>
<field name="relation">res.partner.category</field>
</record>

</odoo>
44 changes: 44 additions & 0 deletions sql_export/demo/sql_export.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
@author Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record id="sql_export_partner" model="sql.export">
<field name="name">Export Partners (Demo Data)</field>
<field name="query"><![CDATA[
SELECT name, street
FROM res_partner;
]]>
</field>
</record>

<function
model="sql.export"
name="button_validate_sql_expression"
eval="([ref('sql_export.sql_export_partner')])"
/>

<record id="sql_export_partner_with_variables" model="sql.export">
<field name="name">Export Partners With Variables (Demo Data)</field>
<field
name="query"
><![CDATA[
SELECT p.id
FROM res_partner p
LEFT JOIN res_partner_res_partner_category_rel rel
ON rel.partner_id = p.id
WHERE create_date &lt; %(x_date)s
AND id = %(x_id)s
AND rel.category_id in %(x_partner_categ_ids)s
]]>
</field>
<field
eval="[(6, 0, [ref('date_field_variable_sql'), ref('integer_field_variable_sql'), ref('m2m_field_variable_sql')])]"
name="field_ids"
/>
</record>

</odoo>
Loading