Browse Source

Add module sql_view (basic model+view)

pull/245/head
Guewen Baconnier 9 years ago
parent
commit
ddd606d3e5
  1. 3
      sql_view/__init__.py
  2. 89
      sql_view/__openerp__.py
  3. 3
      sql_view/models/__init__.py
  4. 33
      sql_view/models/sql_view.py
  5. 58
      sql_view/views/sql_view_views.xml

3
sql_view/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

89
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 <http://www.gnu.org/licenses/>.
#
#
{'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 <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 smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/server-tools/issues/new?body=module:%20sql_view%0Aversion:%207.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
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,
}

3
sql_view/models/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import sql_view

33
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 <http://www.gnu.org/licenses/>.
#
#
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),
}

58
sql_view/views/sql_view_views.xml

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record id="view_sql_view_form" model="ir.ui.view">
<field name="name">sql.view.form</field>
<field name="model">sql.view</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="SQL Views">
<field name="name"/>
<field name="sql_name"/>
<field name="definition" colspan="4"/>
</form>
</field>
</record>
<record id="view_sql_view_tree" model="ir.ui.view">
<field name="name">sql.view.tree</field>
<field name="model">sql.view</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="SQL Views">
<field name="name"/>
<field name="sql_name"/>
</tree>
</field>
</record>
<record id="view_sql_view_search" model="ir.ui.view">
<field name="name">sql.view.filter</field>
<field name="model">sql.view</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="SQL Views">
<field name="name"/>
<field name="sql_name"/>
</search>
</field>
</record>
<record id="action_sql_view" model="ir.actions.act_window">
<field name="name">SQL Views</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sql.view</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_sql_view_search"/>
</record>
<menuitem id="menu_sql_view"
action="action_sql_view"
sequence="20"
parent="base.next_id_9"
string="SQL views"/>
</data>
</openerp>
Loading…
Cancel
Save