From ddd606d3e55686a49c7866a36fbd1b7042b2b5d3 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Mon, 31 Aug 2015 14:04:43 +0200 Subject: [PATCH] Add module sql_view (basic model+view) --- sql_view/__init__.py | 3 ++ sql_view/__openerp__.py | 89 +++++++++++++++++++++++++++++++ sql_view/models/__init__.py | 3 ++ sql_view/models/sql_view.py | 33 ++++++++++++ sql_view/views/sql_view_views.xml | 58 ++++++++++++++++++++ 5 files changed, 186 insertions(+) create mode 100644 sql_view/__init__.py create mode 100644 sql_view/__openerp__.py create mode 100644 sql_view/models/__init__.py create mode 100644 sql_view/models/sql_view.py create mode 100644 sql_view/views/sql_view_views.xml diff --git a/sql_view/__init__.py b/sql_view/__init__.py new file mode 100644 index 000000000..cde864bae --- /dev/null +++ b/sql_view/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/sql_view/__openerp__.py b/sql_view/__openerp__.py new file mode 100644 index 000000000..f0a8c66df --- /dev/null +++ b/sql_view/__openerp__.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# +# +# Authors: Guewen Baconnier +# Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# + +{'name': 'SQL Views', + 'version': '1.0', + 'author': 'Camptocamp,Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'category': 'Tools', + 'depends': ['base'], + 'description': """ +========= +SQL Views +========= + +This addon allows to create SQL views on the database. It also features +a simple CSV export of the views to check their result. + +Configuration +============= + +To configure this module, you need to: + +* go to ... + +Usage +===== + +To use this module, you need to: + +* go to ... + +.. 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/7.0 + +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 smashing it by providing a detailed and welcomed feedback +`here `_. + +Credits +======= + +Contributors +------------ + +* Guewen Baconnier + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://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. + """, + 'website': 'http://www.camptocamp.com', + 'data': ['views/sql_view_views.xml', + ], + 'installable': True, + } diff --git a/sql_view/models/__init__.py b/sql_view/models/__init__.py new file mode 100644 index 000000000..f6da3dc49 --- /dev/null +++ b/sql_view/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import sql_view diff --git a/sql_view/models/sql_view.py b/sql_view/models/sql_view.py new file mode 100644 index 000000000..72d41643d --- /dev/null +++ b/sql_view/models/sql_view.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# +# Authors: Guewen Baconnier +# Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# + + +from openerp.osv import orm, fields + + +class sql_view(orm.Model): + _name = 'sql.view' + + _columns = { + 'name': fields.char(string='View Name', required=True), + 'sql_name': fields.char(string='SQL Name', required=True), + 'definition': fields.text(string='Definition', required=True), + } diff --git a/sql_view/views/sql_view_views.xml b/sql_view/views/sql_view_views.xml new file mode 100644 index 000000000..1477e761c --- /dev/null +++ b/sql_view/views/sql_view_views.xml @@ -0,0 +1,58 @@ + + + + + + sql.view.form + sql.view + form + +
+ + + + + +
+ + + sql.view.tree + sql.view + tree + + + + + + + + + + sql.view.filter + sql.view + search + + + + + + + + + + SQL Views + ir.actions.act_window + sql.view + form + tree,form + + + + + +
+