PORT v12 sql_export
parent
6b7504d8f2
commit
a699d93f1d
|
@ -1,80 +1,9 @@
|
||||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
==========
|
||||||
:alt: License: AGPL-3
|
|
||||||
|
|
||||||
SQL Export
|
SQL Export
|
||||||
==========
|
==========
|
||||||
|
|
||||||
Allow to export data in csv files FROM sql requests.
|
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
There are some restrictions in the sql query, you can only read datas.
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
No update, deletion or creation are possible.
|
!! changes will be overwritten. !!
|
||||||
A new menu named Export is created.
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Usage
|
|
||||||
=====
|
|
||||||
|
|
||||||
Dashboards > Sql Export.
|
|
||||||
|
|
||||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
|
||||||
:alt: Try me on Runbot
|
|
||||||
:target: https://runbot.odoo-community.org/runbot/149/10.0
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
Bug Tracker
|
|
||||||
===========
|
|
||||||
|
|
||||||
Bugs are tracked on `GitHub Issues
|
|
||||||
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
|
|
||||||
check there if your issue has already been reported. If you spotted it first,
|
|
||||||
help us smash it by providing detailed and welcomed feedback.
|
|
||||||
|
|
||||||
Credits
|
|
||||||
=======
|
|
||||||
|
|
||||||
Contributors
|
|
||||||
------------
|
|
||||||
|
|
||||||
* Florian da Costa <florian.dacosta@akretion.com>
|
|
||||||
|
|
||||||
Maintainer
|
|
||||||
----------
|
|
||||||
|
|
||||||
.. image:: http://odoo-community.org/logo.png
|
|
||||||
:alt: Odoo Community Association
|
|
||||||
:target: http://odoo-community.org
|
|
||||||
|
|
||||||
This module is maintained by the OCA.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
To contribute to this module, please visit http://odoo-community.org.
|
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from . import models
|
from . import models
|
||||||
from . import wizard
|
from . import wizard
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (C) 2015 Akretion (<http://www.akretion.com>)
|
# Copyright (C) 2015 Akretion (<http://www.akretion.com>)
|
||||||
# @author: Florian da Costa
|
# @author: Florian da Costa
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'SQL Export',
|
'name': 'SQL Export',
|
||||||
'version': '10.0.1.0.0',
|
'version': '12.0.1.0.0',
|
||||||
'author': 'Akretion,Odoo Community Association (OCA)',
|
'author': 'Akretion,Odoo Community Association (OCA)',
|
||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
|
|
@ -1,3 +1 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from . import sql_export
|
from . import sql_export
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (C) 2015 Akretion (<http://www.akretion.com>)
|
# Copyright (C) 2015 Akretion (<http://www.akretion.com>)
|
||||||
# @author: Florian da Costa
|
# @author: Florian da Costa
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
* `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>
|
|
@ -0,0 +1,4 @@
|
||||||
|
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.
|
|
@ -0,0 +1,16 @@
|
||||||
|
* 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.
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
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)
|
|
@ -1,3 +1 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from . import test_sql_query
|
from . import test_sql_query
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (C) 2015 Akretion (<http://www.akretion.com>)
|
# Copyright (C) 2015 Akretion (<http://www.akretion.com>)
|
||||||
# @author: Florian da Costa
|
# @author: Florian da Costa
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from . import wizard_file
|
from . import wizard_file
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (C) 2015 Akretion (<http://www.akretion.com>)
|
# Copyright (C) 2015 Akretion (<http://www.akretion.com>)
|
||||||
# @author: Florian da Costa
|
# @author: Florian da Costa
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
@ -74,18 +74,18 @@ class SqlFileWizard(models.TransientModel):
|
||||||
params=variable_dict, mode='stdout',
|
params=variable_dict, mode='stdout',
|
||||||
copy_options=sql_export.copy_options)
|
copy_options=sql_export.copy_options)
|
||||||
if self.sql_export_id.encoding:
|
if self.sql_export_id.encoding:
|
||||||
res = res.encode(self.sql_export_id.encoding)
|
res = res.decode(self.sql_export_id.encoding)
|
||||||
self.write({
|
self.write({
|
||||||
'binary_file': res,
|
'binary_file': res,
|
||||||
'file_name': sql_export.name + '_' + date + '.csv'
|
'file_name': '%(name)s_%(date)s.csv' % {
|
||||||
|
'name': sql_export.name, 'date': date}
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
'view_type': 'form',
|
|
||||||
'view_mode': 'form',
|
'view_mode': 'form',
|
||||||
'res_model': 'sql.file.wizard',
|
'res_model': 'sql.file.wizard',
|
||||||
'res_id': self.id,
|
'res_id': self.id,
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
'target': 'new',
|
'target': 'new',
|
||||||
'context': self._context,
|
'context': self.env.context,
|
||||||
'nodestroy': True,
|
'nodestroy': True,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue