Merge lp:~dreis-pt/openobject-extension/base_external_dbsource-v7 into lp:openobject-extension

Proposed by Daniel Reis
Status: Needs review
Proposed branch: lp:~dreis-pt/openobject-extension/base_external_dbsource-v7
Merge into: lp:openobject-extension
Diff against target: 373 lines (+333/-0)
7 files modified
base_external_dbsource/__init__.py (+24/-0)
base_external_dbsource/__openerp__.py (+61/-0)
base_external_dbsource/base_external_dbsource.py (+178/-0)
base_external_dbsource/base_external_dbsource_demo.xml (+13/-0)
base_external_dbsource/base_external_dbsource_view.xml (+50/-0)
base_external_dbsource/security/ir.model.access.csv (+2/-0)
base_external_dbsource/test/dbsource_connect.yml (+5/-0)
To merge this branch: bzr merge lp:~dreis-pt/openobject-extension/base_external_dbsource-v7
Reviewer Review Type Date Requested Status
Maxime Chambreuil (http://www.savoirfairelinux.com) Needs Fixing
David (community) Needs Information
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+159673@code.launchpad.net

Description of the change

Ported base_external_dbsource to v7.

To post a comment you must log in.
374. By Daniel Reis

fix typo

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
David (dhecar) wrote :

Whats the correct version for 6.1?

review: Needs Information
Revision history for this message
Daniel Reis (dreis-pt) wrote :

@David, I'm sorry I don't understand the question. Could you rephrase it please?

Revision history for this message
David (dhecar) wrote :

Hello, i'm triying to use the module base_external_dbsource in Openerp 6.1

Where is the correct module for this version?

I've installed base_external_dbsource-v7 ans I'm getting error datetime.

openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/osv/osv.py", line 129, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/server/openerp/osv/osv.py", line 195, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/server/openerp/osv/osv.py", line 183, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp/server/openerp/addons/import_odbc/import_odbc.py",
line 147, in import_run
    else: sync = datetime.datetime(1900, 1, 1, 0, 0, 0)
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'
2013-05-09 13:24:07,131 14273 ERROR ? openerp.netsvc: type object
'datetime.datetime' has no attribute 'datetime'

if i change import datetime from datetime to import datetime, the error
change to:

 openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/osv/osv.py", line 129, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/server/openerp/osv/osv.py", line 195, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/server/openerp/osv/osv.py", line 183, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp/server/openerp/addons/import_odbc/import_odbc.py",
line 138, in import_run
    log = {'start_run': datetime.now().replace(microsecond=0),
AttributeError: 'module' object has no attribute 'now'
2013-05-10 08:57:27,141 32035 ERROR ? openerp.netsvc: 'module' object has
no attribute 'now'

2013/5/10 Daniel Reis (SECURITAS SA) <email address hidden>

> @David, I'm sorry I don't understand the question. Could you rephrase it
> please?
> --
>
> https://code.launchpad.net/~dreis-pt/openobject-extension/base_external_dbsource-v7/+merge/159673
> You are reviewing the proposed merge of
> lp:~dreis-pt/openobject-extension/base_external_dbsource-v7 into
> lp:openobject-extension.
>

--

*Serveis Informàtics a Pimes i Particulars*

- Manteniment de xarxes i servidors
- Reinstal·lacions de sistemes
- Desinfecció de virus
- Instal·lació de Linux
- Implementació d'Openerp (Gestió empresa)

http://sinergiainformatica.net

Tefl: 659 522 073

Revision history for this message
Daniel Reis (dreis-pt) wrote :

@Maxime: this is a dependency for mgmtsystem_kpi; do you think you could review or test this?

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

sure, but not this week.

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

@Daniel

I have managed to test it. Everything is working well up to the point where I compute a KPI and execute a query against an external database (MySQL). I got this error message:

Server Traceback (most recent call last):
  File "/home/max/openerp/web/7.0/addons/web/session.py", line 89, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/home/max/openerp/server/7.0/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/max/openerp/server/7.0/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/home/max/openerp/server/7.0/openerp/osv/osv.py", line 188, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/max/openerp/server/7.0/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/max/openerp/server/7.0/openerp/osv/osv.py", line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/max/openerp/server/7.0/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/max/openerp/mgmtsystem/7.0/mgmtsystem_kpi/mgmtsystem_kpi.py", line 294, in compute_kpi_value
    res = dbsrc_obj.execute(obj.kpi_code)
  File "/home/max/openerp/server/7.0/openerp/osv/orm.py", line 374, in function_proxy
    return attr(self._cr, self._uid, [self._id], *args, **kwargs)
  File "/home/max/openerp/local/base_external_dbsource/base_external_dbsource.py", line 140, in execute
    cur = conn.execute(sqlquery, sqlparams)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1449, in execute
    params)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1628, in _execute_text
    statement, parameters
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1691, in _execute_context
    context)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 331, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 159, in execute
    query = query % db.literal(args)
TypeError: not all arguments converted during string formatting

I will do further debugging tomorrow.

Revision history for this message
David (dhecar) wrote :
Download full text (3.9 KiB)

Hi, Finally I found this

http://bazaar.launchpad.net/~openerp-community/openobject-extension/import_odbc_base_external_dbsource/
with revision 357.

I have changed some lines in order to work, but i'm not sure it's
correct.(See the diff.patch file)

Another error is when the cron job is running:

2013-05-25 10:50:57,144 27878 ERROR ? openerp.addons.base.ir.ir_cron: Call
of self.pool.get('import.odbc.dbtable').import_run(cr, uid, *()) failed in
Job 16
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/addons/base/ir/ir_cron.py", line 146,
in _callback
    method(cr, uid, *args)
  File "/opt/openerp/server/openerp/addons/import_odbc/import_odbc.py",
line 120, in import_run
    actions = self.read(cr, uid, ids, ['id', 'exec_order'])
  File "/opt/openerp/server/openerp/osv/orm.py", line 3415, in read
    select = map(lambda x: isinstance(x, dict) and x['id'] or x, select)
TypeError: argument 2 to map() must support iteration

2013/5/25 Maxime Chambreuil (http://www.savoirfairelinux.com) <
<email address hidden>>

> @Daniel
>
> I have managed to test it. Everything is working well up to the point
> where I compute a KPI and execute a query against an external database
> (MySQL). I got this error message:
>
> Server Traceback (most recent call last):
> File "/home/max/openerp/web/7.0/addons/web/session.py", line 89, in send
> return openerp.netsvc.dispatch_rpc(service_name, method, args)
> File "/home/max/openerp/server/7.0/openerp/netsvc.py", line 292, in
> dispatch_rpc
> result = ExportService.getService(service_name).dispatch(method,
> params)
> File "/home/max/openerp/server/7.0/openerp/service/web_services.py",
> line 626, in dispatch
> res = fn(db, uid, *params)
> File "/home/max/openerp/server/7.0/openerp/osv/osv.py", line 188, in
> execute_kw
> return self.execute(db, uid, obj, method, *args, **kw or {})
> File "/home/max/openerp/server/7.0/openerp/osv/osv.py", line 131, in
> wrapper
> return f(self, dbname, *args, **kwargs)
> File "/home/max/openerp/server/7.0/openerp/osv/osv.py", line 197, in
> execute
> res = self.execute_cr(cr, uid, obj, method, *args, **kw)
> File "/home/max/openerp/server/7.0/openerp/osv/osv.py", line 185, in
> execute_cr
> return getattr(object, method)(cr, uid, *args, **kw)
> File
> "/home/max/openerp/mgmtsystem/7.0/mgmtsystem_kpi/mgmtsystem_kpi.py", line
> 294, in compute_kpi_value
> res = dbsrc_obj.execute(obj.kpi_code)
> File "/home/max/openerp/server/7.0/openerp/osv/orm.py", line 374, in
> function_proxy
> return attr(self._cr, self._uid, [self._id], *args, **kwargs)
> File
> "/home/max/openerp/local/base_external_dbsource/base_external_dbsource.py",
> line 140, in execute
> cur = conn.execute(sqlquery, sqlparams)
> File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
> 1449, in execute
> params)
> File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
> 1628, in _execute_text
> statement, parameters
> File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
> 1691, in _execute_context
> context)
> File "/usr/lib/python2.7/dist-packages...

Read more...

0-- /opt/MODULOS-6.1/import_odbc.py 2013-05-15 08:23:59.158992062 +00000++ /opt/MODULOS-6.1/import_odbc_base_external_dbsource/import_odbc/import_odbc.py 2013-05-13 09:58:18.978992838 +0000
@@ -134,7 +134,7 @@
134 model_name = obj.model_target.model134 model_name = obj.model_target.model
135 model_obj = self.pool.get(model_name)135 model_obj = self.pool.get(model_name)
136 xml_prefix = model_name.replace('.', '_') + "_id_"136 xml_prefix = model_name.replace('.', '_') + "_id_"
137 log = {'start_run': datetime.now().replace(microsecond=0),137 log = {'start_run': datetime.today().replace(microsecond=0),
138 'last_run': None,138 'last_run': None,
139 'last_record_count': 0,139 'last_record_count': 0,
140 'last_error_count': 0,140 'last_error_count': 0,
@@ -144,7 +144,7 @@
144144
145 #Prepare SQL sentence; replace "%s" with the last_sync date145 #Prepare SQL sentence; replace "%s" with the last_sync date
146 if obj.last_sync: sync = datetime.strptime(obj.last_sync, "%Y-%m-%d %H:%M:%S")146 if obj.last_sync: sync = datetime.strptime(obj.last_sync, "%Y-%m-%d %H:%M:%S")
147 else: sync = datetime.datetime(1900, 1, 1, 0, 0, 0)147 else: sync = datetime(1900, 1, 1, 0, 0, 0)
148 params = {'sync': sync}148 params = {'sync': sync}
149 res = db_model.execute(cr, uid, [obj.dbsource_id.id], obj.sql_source, params, metadata=True)149 res = db_model.execute(cr, uid, [obj.dbsource_id.id], obj.sql_source, params, metadata=True)
150 150
@@ -183,7 +183,7 @@
183 if log['last_log']: 183 if log['last_log']:
184 log['last_log'].insert(0, 'LEVEL|== Line == |== Relationship ==|== Message ==')184 log['last_log'].insert(0, 'LEVEL|== Line == |== Relationship ==|== Message ==')
185 log.update( {'last_log': '\n'.join(log['last_log'])} )185 log.update( {'last_log': '\n'.join(log['last_log'])} )
186 log.update({ 'last_run': datetime.now().replace(microsecond=0) }) #second=0, 186 log.update({ 'last_run': datetime.today().replace(microsecond=0) }) #second=0,
187 self.write(cr, uid, [obj.id], log)187 self.write(cr, uid, [obj.id], log)
188 #Finished188 #Finished
189 _logger.debug('Import job FINISHED.')189 _logger.debug('Import job FINISHED.')
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Problem was that sqlparams default value didn't work.

l340: replace sqlparams=None by sqlparams=[]

review: Needs Fixing
375. By Daniel Reis

Handle empty sqlparams

Revision history for this message
Daniel Reis (dreis-pt) wrote :

Maxime, just fixed the problem you reported.
I'm not using this right now, but I would like it to get merged, so that someone else that needs it can pick it up and go improve it.

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

@Daniel

Can you fix the conflicts ?

Thanks.

review: Needs Fixing
376. By Daniel Reis

Resolve conflicts

Unmerged revisions

376. By Daniel Reis

Resolve conflicts

375. By Daniel Reis

Handle empty sqlparams

374. By Daniel Reis

fix typo

373. By Daniel Reis

Ported base_external_dbsource to v7

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'base_external_dbsource'
=== added file 'base_external_dbsource/__init__.py'
--- base_external_dbsource/__init__.py 1970-01-01 00:00:00 +0000
+++ base_external_dbsource/__init__.py 2014-01-24 13:37:33 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Daniel Reis
5# 2011
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import base_external_dbsource
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
025
=== added file 'base_external_dbsource/__openerp__.py'
--- base_external_dbsource/__openerp__.py 1970-01-01 00:00:00 +0000
+++ base_external_dbsource/__openerp__.py 2014-01-24 13:37:33 +0000
@@ -0,0 +1,61 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Daniel Reis, 2011
5# Additional contributions by Maxime Chambreuil, Savoir-faire Linux
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22{
23 'name': 'External Database Sources',
24 'version': '61.3',
25 'category': 'Tools',
26 'description': """
27Connect your OpenERP server to external databases to exchange data through SQL.
28Supports PostgreSQL, MySQL, SQLite, MS SQL Server, Oracle and ODBC.
29
30Configure and test your connections at:
31Settings > Technical > Database Structure > Database Sources
32
33Depending on the type of database you are conencting, you will to install
34additional libraries on your system:
35
36 ODBC: packages unixodbc and python-pyodbc.
37 MS SQL Server: FreeTDS driver (tdsodbc package).
38 Oracle: Oracle Instant Client and cx_Oracle python library.
39""",
40 'author': 'Daniel Reis',
41 'website': 'http://launchpad.net/addons-tko',
42 'images': [
43 'images/screenshot01.png',
44 ],
45 'depends': [
46 'base',
47 ],
48 'init': [],
49 'data': [
50 'base_external_dbsource_view.xml',
51 'security/ir.model.access.csv',
52 ],
53 'demo': [
54 'base_external_dbsource_demo.xml',
55 ],
56 'test': [
57 'test/dbsource_connect.yml',
58 ],
59}
60
61# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
062
=== added file 'base_external_dbsource/base_external_dbsource.py'
--- base_external_dbsource/base_external_dbsource.py 1970-01-01 00:00:00 +0000
+++ base_external_dbsource/base_external_dbsource.py 2014-01-24 13:37:33 +0000
@@ -0,0 +1,178 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Daniel Reis
5# 2011
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import os
23from openerp.osv import fields, orm
24from openerp.tools.translate import _
25import openerp.tools as tools
26import logging
27_logger = logging.getLogger(__name__)
28
29CONNECTORS = []
30
31try:
32 import sqlalchemy
33 import pymssql # lint:ok
34 CONNECTORS.append(('mssql', 'Microsoft SQL Server'))
35except:
36 _logger.info('MS SQL Server not available. Please install "slqalchemy"'
37 ' and ''"pymssql" python package.')
38
39try:
40 import sqlalchemy # lint:ok
41 import MySQLdb # lint:ok
42 CONNECTORS.append(('mysql', 'MySQL'))
43except:
44 _logger.info('MySQL not available. Please install "slqalchemy"'
45 ' and "mysqldb" python package.')
46
47try:
48 import pyodbc
49 CONNECTORS.append(('pyodbc', 'ODBC'))
50except:
51 _logger.info('ODBC libraries not available. Please install "unixodbc"'
52 ' and "python-pyodbc" packages.')
53
54try:
55 import cx_Oracle
56 CONNECTORS.append(('cx_Oracle', 'Oracle'))
57except:
58 _logger.info('Oracle libraries not available. Please install "cx_Oracle"'
59 ' python package.')
60
61import psycopg2
62CONNECTORS.append(('postgresql', 'PostgreSQL'))
63
64try:
65 import sqlalchemy # lint:ok
66 CONNECTORS.append(('sqlite', 'SQLite'))
67except:
68 _logger.info('SQLAlchemy not available. Please install "slqalchemy"'
69 ' python package.')
70
71
72class BaseExternalDBSource(orm.Model):
73 _name = "base.external.dbsource"
74 _description = 'External Database Sources'
75 _columns = {
76 'name': fields.char('Datasource name', required=True, size=64),
77 'conn_string': fields.text('Connection string', help="""\
78Sample connection strings:
79- Microsoft SQL Server: mssql+pymssql://username:%s@server:port/dbname?charset=utf8
80- MySQL: mysql://user:%s@server:port/dbname
81- ODBC: DRIVER={FreeTDS};SERVER=server.address;Database=mydb;UID=sa
82- ORACLE: username/%s@//server.address:port/instance
83- PostgreSQL: dbname='template1' user='dbuser' host='localhost' port='5432' password=%s
84- SQLite: sqlite:///test.db
85"""),
86 'password': fields.char('Password', size=40),
87 'connector': fields.selection(CONNECTORS, 'Connector', required=True,
88 help="If a connector is missing from the list, check the "
89 " log to confirm that the required componentes"
90 " were detected."),
91 }
92
93 def conn_open(self, cr, uid, id1):
94 """
95 Create and return a connection defined in
96 the id1 base_external_dbsource record
97 """
98 #Get dbsource record
99 data = self.browse(cr, uid, id1)
100 #Build the full connection string
101 connStr = data.conn_string
102 if data.password:
103 if '%s' not in data.conn_string:
104 connStr += ';PWD=%s'
105 connStr = connStr % data.password
106 #Try to connect
107 if data.connector == 'cx_Oracle':
108 os.environ['NLS_LANG'] = 'AMERICAN_AMERICA.UTF8'
109 conn = cx_Oracle.connect(connStr)
110 elif data.connector == 'pyodbc':
111 conn = pyodbc.connect(connStr)
112 elif data.connector in ('sqlite', 'mysql', 'mssql'):
113 conn = sqlalchemy.create_engine(connStr).connect()
114 elif data.connector == 'postgresql':
115 conn = psycopg2.connect(connStr)
116
117 return conn
118
119 def execute(self, cr, uid, ids, sqlquery, sqlparams=None, metadata=False,
120 context=None):
121 """
122 Executes SQL and returns a list of rows.
123 `sqlparams` can be a dict of values, that can be referenced in the SQL
124 statement using "%(key)s" or, in the case of Oracle, ":key".
125 Example:
126 sqlquery = "select * from mytable "
127 "where city = %(city)s and date > %(dt)s"
128 params = {'city': 'Lisbon', 'dt': datetime.datetime(2000, 12, 31)}
129 If `metadata==True`, it will instead return a dict containing the
130 rows list and the columns list, in the format:
131 { 'cols': [ 'col_a', 'col_b', ...]
132 , 'rows': [ (a0, b0, ...), (a1, b1, ...), ...] }
133 """
134 sqlparams = sqlparams or []
135 data = self.browse(cr, uid, ids)
136 rows, cols = list(), list()
137 for obj in data:
138 conn = self.conn_open(cr, uid, obj.id)
139 if obj.connector in ["sqlite", "mysql", "mssql"]:
140 #using sqlalchemy
141 cur = conn.execute(sqlquery, sqlparams)
142 if metadata:
143 cols = cur.keys()
144 rows = [r for r in cur]
145 else:
146 #using other db connectors
147 cur = conn.cursor()
148 cur.execute(sqlquery, sqlparams)
149 if metadata:
150 cols = [d[0] for d in cur.description]
151 rows = cur.fetchall()
152 conn.close()
153 if metadata:
154 return{'cols': cols, 'rows': rows}
155 else:
156 return rows
157
158 def connection_test(self, cr, uid, ids, context=None):
159 """Test a connection. Returns an os"""
160 for obj in self.browse(cr, uid, ids, context):
161 conn = False
162 try:
163 conn = self.conn_open(cr, uid, obj.id)
164 except Exception, e:
165 raise orm.except_orm(
166 _("Connection test failed!"),
167 _("Here is what we got instead:\n %s") % tools.ustr(e))
168 finally:
169 try:
170 if conn:
171 conn.close()
172 except Exception:
173 # ignored, just a consequence of the previous exception
174 pass
175 #TODO: if OK a (wizard) message box should be displayed
176 raise orm.except_orm(
177 _("Connection test succeeded!"),
178 _("Everything seems properly set up!"))
0179
=== added file 'base_external_dbsource/base_external_dbsource_demo.xml'
--- base_external_dbsource/base_external_dbsource_demo.xml 1970-01-01 00:00:00 +0000
+++ base_external_dbsource/base_external_dbsource_demo.xml 2014-01-24 13:37:33 +0000
@@ -0,0 +1,13 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4
5 <record model="base.external.dbsource" id="demo_postgre">
6 <field name="name">PostgreSQL local</field>
7 <field name="conn_string">dbname='postgres' password=%s</field>
8 <field name="password">postgresql</field>
9 <field name="connector">postgresql</field>
10 </record>
11
12 </data>
13</openerp>
014
=== added file 'base_external_dbsource/base_external_dbsource_view.xml'
--- base_external_dbsource/base_external_dbsource_view.xml 1970-01-01 00:00:00 +0000
+++ base_external_dbsource/base_external_dbsource_view.xml 2014-01-24 13:37:33 +0000
@@ -0,0 +1,50 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4
5 <record model="ir.ui.view" id="view_dbsource_tree">
6 <field name="name">base.external.dbsource.tree</field>
7 <field name="model">base.external.dbsource</field>
8 <field name="type">tree</field>
9 <field name="arch" type="xml">
10 <tree string="External DB Sources">
11 <field name="name"/>
12 <field name="connector"/>
13 <field name="conn_string"/>
14 </tree>
15 </field>
16 </record>
17
18 <record model="ir.ui.view" id="view_dbsource_form">
19 <field name="name">base.external.dbsource.form</field>
20 <field name="model">base.external.dbsource</field>
21 <field name="type">form</field>
22 <field name="arch" type="xml">
23 <form string="External DB Source">
24 <field name="name"/>
25 <field name="connector"/>
26 <field name="conn_string"/>
27 <field name="password" password="True"/>
28 <button name="connection_test" string="Test Connection"
29 type="object" icon="gtk-network"/>
30 </form>
31 </field>
32 </record>
33
34 <record model="ir.actions.act_window" id="action_dbsource">
35 <field name="name">External Database Sources</field>
36 <field name="res_model">base.external.dbsource</field>
37 <field name="view_type">form</field>
38 <field name="view_mode">tree,form</field>
39 <field name="view_id" ref="view_dbsource_tree"/>
40 </record>
41
42 <menuitem name="Database Sources"
43 id="menu_dbsource"
44 parent="base.next_id_9"
45 action="action_dbsource"/>
46
47 </data>
48</openerp>
49
50
051
=== added directory 'base_external_dbsource/images'
=== added file 'base_external_dbsource/images/screenshot01.png'
1Binary files base_external_dbsource/images/screenshot01.png 1970-01-01 00:00:00 +0000 and base_external_dbsource/images/screenshot01.png 2014-01-24 13:37:33 +0000 differ52Binary files base_external_dbsource/images/screenshot01.png 1970-01-01 00:00:00 +0000 and base_external_dbsource/images/screenshot01.png 2014-01-24 13:37:33 +0000 differ
=== added directory 'base_external_dbsource/security'
=== added file 'base_external_dbsource/security/ir.model.access.csv'
--- base_external_dbsource/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ base_external_dbsource/security/ir.model.access.csv 2014-01-24 13:37:33 +0000
@@ -0,0 +1,2 @@
1id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2access_base_external_dbsource_group_system,bae_external_dbsource_group_system,model_base_external_dbsource,base.group_system,1,1,1,1
03
=== added directory 'base_external_dbsource/test'
=== added file 'base_external_dbsource/test/dbsource_connect.yml'
--- base_external_dbsource/test/dbsource_connect.yml 1970-01-01 00:00:00 +0000
+++ base_external_dbsource/test/dbsource_connect.yml 2014-01-24 13:37:33 +0000
@@ -0,0 +1,5 @@
1-
2 Connect to local Postgres.
3-
4 !python {model: base.external.dbsource}: |
5 self.connection_test(cr, uid, [ref("demo_postgre")])

Subscribers

People subscribed via source and target branches