Merge lp:~dreis-pt/openobject-extension/base_external_dbsource-v7 into lp:openobject-extension
- base_external_dbsource-v7
- Merge into 7.0
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 |
Related bugs: |
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 |
Commit message
Description of the change
Ported base_external_
- 374. By Daniel Reis
-
fix typo
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote : | # |
David (dhecar) wrote : | # |
Whats the correct version for 6.1?
Daniel Reis (dreis-pt) wrote : | # |
@David, I'm sorry I don't understand the question. Could you rephrase it please?
David (dhecar) wrote : | # |
Hello, i'm triying to use the module base_external_
Where is the correct module for this version?
I've installed base_external_
openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
File "/opt/openerp/
return f(self, dbname, *args, **kwargs)
File "/opt/openerp/
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/openerp/
return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/openerp/
line 147, in import_run
else: sync = datetime.
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/
return f(self, dbname, *args, **kwargs)
File "/opt/openerp/
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/openerp/
return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/openerp/
line 138, in import_run
log = {'start_run': datetime.
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:/
> 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://
Tefl: 659 522 073
Daniel Reis (dreis-pt) wrote : | # |
@Maxime: this is a dependency for mgmtsystem_kpi; do you think you could review or test this?
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote : | # |
sure, but not this week.
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/
return openerp.
File "/home/
result = ExportService.
File "/home/
res = fn(db, uid, *params)
File "/home/
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/home/
return f(self, dbname, *args, **kwargs)
File "/home/
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/
res = dbsrc_obj.
File "/home/
return attr(self._cr, self._uid, [self._id], *args, **kwargs)
File "/home/
cur = conn.execute(
File "/usr/lib/
params)
File "/usr/lib/
statement, parameters
File "/usr/lib/
context)
File "/usr/lib/
cursor.
File "/usr/lib/
query = query % db.literal(args)
TypeError: not all arguments converted during string formatting
I will do further debugging tomorrow.
David (dhecar) wrote : | # |
Hi, Finally I found this
http://
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.
of self.pool.
Job 16
Traceback (most recent call last):
File "/opt/openerp/
in _callback
method(cr, uid, *args)
File "/opt/openerp/
line 120, in import_run
actions = self.read(cr, uid, ids, ['id', 'exec_order'])
File "/opt/openerp/
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://
<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/
> return openerp.
> File "/home/
> dispatch_rpc
> result = ExportService.
> params)
> File "/home/
> line 626, in dispatch
> res = fn(db, uid, *params)
> File "/home/
> execute_kw
> return self.execute(db, uid, obj, method, *args, **kw or {})
> File "/home/
> wrapper
> return f(self, dbname, *args, **kwargs)
> File "/home/
> execute
> res = self.execute_cr(cr, uid, obj, method, *args, **kw)
> File "/home/
> execute_cr
> return getattr(object, method)(cr, uid, *args, **kw)
> File
> "/home/
> 294, in compute_kpi_value
> res = dbsrc_obj.
> File "/home/
> function_proxy
> return attr(self._cr, self._uid, [self._id], *args, **kwargs)
> File
> "/home/
> line 140, in execute
> cur = conn.execute(
> File "/usr/lib/
> 1449, in execute
> params)
> File "/usr/lib/
> 1628, in _execute_text
> statement, parameters
> File "/usr/lib/
> 1691, in _execute_context
> context)
> File "/usr/lib/
1 | --- /opt/MODULOS-6.1/import_odbc.py 2013-05-15 08:23:59.158992062 +0000 |
2 | +++ /opt/MODULOS-6.1/import_odbc_base_external_dbsource/import_odbc/import_odbc.py 2013-05-13 09:58:18.978992838 +0000 |
3 | @@ -134,7 +134,7 @@ |
4 | model_name = obj.model_target.model |
5 | model_obj = self.pool.get(model_name) |
6 | xml_prefix = model_name.replace('.', '_') + "_id_" |
7 | - log = {'start_run': datetime.now().replace(microsecond=0), |
8 | + log = {'start_run': datetime.today().replace(microsecond=0), |
9 | 'last_run': None, |
10 | 'last_record_count': 0, |
11 | 'last_error_count': 0, |
12 | @@ -144,7 +144,7 @@ |
13 | |
14 | #Prepare SQL sentence; replace "%s" with the last_sync date |
15 | if obj.last_sync: sync = datetime.strptime(obj.last_sync, "%Y-%m-%d %H:%M:%S") |
16 | - else: sync = datetime.datetime(1900, 1, 1, 0, 0, 0) |
17 | + else: sync = datetime(1900, 1, 1, 0, 0, 0) |
18 | params = {'sync': sync} |
19 | res = db_model.execute(cr, uid, [obj.dbsource_id.id], obj.sql_source, params, metadata=True) |
20 | |
21 | @@ -183,7 +183,7 @@ |
22 | if log['last_log']: |
23 | log['last_log'].insert(0, 'LEVEL|== Line == |== Relationship ==|== Message ==') |
24 | log.update( {'last_log': '\n'.join(log['last_log'])} ) |
25 | - log.update({ 'last_run': datetime.now().replace(microsecond=0) }) #second=0, |
26 | + log.update({ 'last_run': datetime.today().replace(microsecond=0) }) #second=0, |
27 | self.write(cr, uid, [obj.id], log) |
28 | #Finished |
29 | _logger.debug('Import job FINISHED.') |
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote : | # |
Problem was that sqlparams default value didn't work.
l340: replace sqlparams=None by sqlparams=[]
- 375. By Daniel Reis
-
Handle empty sqlparams
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.
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote : | # |
@Daniel
Can you fix the conflicts ?
Thanks.
- 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
1 | === added directory 'base_external_dbsource' |
2 | === added file 'base_external_dbsource/__init__.py' |
3 | --- base_external_dbsource/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ base_external_dbsource/__init__.py 2014-01-24 13:37:33 +0000 |
5 | @@ -0,0 +1,24 @@ |
6 | +# -*- coding: utf-8 -*- |
7 | +############################################################################## |
8 | +# |
9 | +# Daniel Reis |
10 | +# 2011 |
11 | +# |
12 | +# This program is free software: you can redistribute it and/or modify |
13 | +# it under the terms of the GNU Affero General Public License as |
14 | +# published by the Free Software Foundation, either version 3 of the |
15 | +# License, or (at your option) any later version. |
16 | +# |
17 | +# This program is distributed in the hope that it will be useful, |
18 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | +# GNU Affero General Public License for more details. |
21 | +# |
22 | +# You should have received a copy of the GNU Affero General Public License |
23 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
24 | +# |
25 | +############################################################################## |
26 | + |
27 | +import base_external_dbsource |
28 | + |
29 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
30 | |
31 | === added file 'base_external_dbsource/__openerp__.py' |
32 | --- base_external_dbsource/__openerp__.py 1970-01-01 00:00:00 +0000 |
33 | +++ base_external_dbsource/__openerp__.py 2014-01-24 13:37:33 +0000 |
34 | @@ -0,0 +1,61 @@ |
35 | +# -*- coding: utf-8 -*- |
36 | +############################################################################## |
37 | +# |
38 | +# Daniel Reis, 2011 |
39 | +# Additional contributions by Maxime Chambreuil, Savoir-faire Linux |
40 | +# |
41 | +# This program is free software: you can redistribute it and/or modify |
42 | +# it under the terms of the GNU Affero General Public License as |
43 | +# published by the Free Software Foundation, either version 3 of the |
44 | +# License, or (at your option) any later version. |
45 | +# |
46 | +# This program is distributed in the hope that it will be useful, |
47 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
48 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
49 | +# GNU Affero General Public License for more details. |
50 | +# |
51 | +# You should have received a copy of the GNU Affero General Public License |
52 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
53 | +# |
54 | +############################################################################## |
55 | + |
56 | +{ |
57 | + 'name': 'External Database Sources', |
58 | + 'version': '61.3', |
59 | + 'category': 'Tools', |
60 | + 'description': """ |
61 | +Connect your OpenERP server to external databases to exchange data through SQL. |
62 | +Supports PostgreSQL, MySQL, SQLite, MS SQL Server, Oracle and ODBC. |
63 | + |
64 | +Configure and test your connections at: |
65 | +Settings > Technical > Database Structure > Database Sources |
66 | + |
67 | +Depending on the type of database you are conencting, you will to install |
68 | +additional libraries on your system: |
69 | + |
70 | + ODBC: packages unixodbc and python-pyodbc. |
71 | + MS SQL Server: FreeTDS driver (tdsodbc package). |
72 | + Oracle: Oracle Instant Client and cx_Oracle python library. |
73 | +""", |
74 | + 'author': 'Daniel Reis', |
75 | + 'website': 'http://launchpad.net/addons-tko', |
76 | + 'images': [ |
77 | + 'images/screenshot01.png', |
78 | + ], |
79 | + 'depends': [ |
80 | + 'base', |
81 | + ], |
82 | + 'init': [], |
83 | + 'data': [ |
84 | + 'base_external_dbsource_view.xml', |
85 | + 'security/ir.model.access.csv', |
86 | + ], |
87 | + 'demo': [ |
88 | + 'base_external_dbsource_demo.xml', |
89 | + ], |
90 | + 'test': [ |
91 | + 'test/dbsource_connect.yml', |
92 | + ], |
93 | +} |
94 | + |
95 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
96 | |
97 | === added file 'base_external_dbsource/base_external_dbsource.py' |
98 | --- base_external_dbsource/base_external_dbsource.py 1970-01-01 00:00:00 +0000 |
99 | +++ base_external_dbsource/base_external_dbsource.py 2014-01-24 13:37:33 +0000 |
100 | @@ -0,0 +1,178 @@ |
101 | +# -*- coding: utf-8 -*- |
102 | +############################################################################## |
103 | +# |
104 | +# Daniel Reis |
105 | +# 2011 |
106 | +# |
107 | +# This program is free software: you can redistribute it and/or modify |
108 | +# it under the terms of the GNU Affero General Public License as |
109 | +# published by the Free Software Foundation, either version 3 of the |
110 | +# License, or (at your option) any later version. |
111 | +# |
112 | +# This program is distributed in the hope that it will be useful, |
113 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
114 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
115 | +# GNU Affero General Public License for more details. |
116 | +# |
117 | +# You should have received a copy of the GNU Affero General Public License |
118 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
119 | +# |
120 | +############################################################################## |
121 | + |
122 | +import os |
123 | +from openerp.osv import fields, orm |
124 | +from openerp.tools.translate import _ |
125 | +import openerp.tools as tools |
126 | +import logging |
127 | +_logger = logging.getLogger(__name__) |
128 | + |
129 | +CONNECTORS = [] |
130 | + |
131 | +try: |
132 | + import sqlalchemy |
133 | + import pymssql # lint:ok |
134 | + CONNECTORS.append(('mssql', 'Microsoft SQL Server')) |
135 | +except: |
136 | + _logger.info('MS SQL Server not available. Please install "slqalchemy"' |
137 | + ' and ''"pymssql" python package.') |
138 | + |
139 | +try: |
140 | + import sqlalchemy # lint:ok |
141 | + import MySQLdb # lint:ok |
142 | + CONNECTORS.append(('mysql', 'MySQL')) |
143 | +except: |
144 | + _logger.info('MySQL not available. Please install "slqalchemy"' |
145 | + ' and "mysqldb" python package.') |
146 | + |
147 | +try: |
148 | + import pyodbc |
149 | + CONNECTORS.append(('pyodbc', 'ODBC')) |
150 | +except: |
151 | + _logger.info('ODBC libraries not available. Please install "unixodbc"' |
152 | + ' and "python-pyodbc" packages.') |
153 | + |
154 | +try: |
155 | + import cx_Oracle |
156 | + CONNECTORS.append(('cx_Oracle', 'Oracle')) |
157 | +except: |
158 | + _logger.info('Oracle libraries not available. Please install "cx_Oracle"' |
159 | + ' python package.') |
160 | + |
161 | +import psycopg2 |
162 | +CONNECTORS.append(('postgresql', 'PostgreSQL')) |
163 | + |
164 | +try: |
165 | + import sqlalchemy # lint:ok |
166 | + CONNECTORS.append(('sqlite', 'SQLite')) |
167 | +except: |
168 | + _logger.info('SQLAlchemy not available. Please install "slqalchemy"' |
169 | + ' python package.') |
170 | + |
171 | + |
172 | +class BaseExternalDBSource(orm.Model): |
173 | + _name = "base.external.dbsource" |
174 | + _description = 'External Database Sources' |
175 | + _columns = { |
176 | + 'name': fields.char('Datasource name', required=True, size=64), |
177 | + 'conn_string': fields.text('Connection string', help="""\ |
178 | +Sample connection strings: |
179 | +- Microsoft SQL Server: mssql+pymssql://username:%s@server:port/dbname?charset=utf8 |
180 | +- MySQL: mysql://user:%s@server:port/dbname |
181 | +- ODBC: DRIVER={FreeTDS};SERVER=server.address;Database=mydb;UID=sa |
182 | +- ORACLE: username/%s@//server.address:port/instance |
183 | +- PostgreSQL: dbname='template1' user='dbuser' host='localhost' port='5432' password=%s |
184 | +- SQLite: sqlite:///test.db |
185 | +"""), |
186 | + 'password': fields.char('Password', size=40), |
187 | + 'connector': fields.selection(CONNECTORS, 'Connector', required=True, |
188 | + help="If a connector is missing from the list, check the " |
189 | + " log to confirm that the required componentes" |
190 | + " were detected."), |
191 | + } |
192 | + |
193 | + def conn_open(self, cr, uid, id1): |
194 | + """ |
195 | + Create and return a connection defined in |
196 | + the id1 base_external_dbsource record |
197 | + """ |
198 | + #Get dbsource record |
199 | + data = self.browse(cr, uid, id1) |
200 | + #Build the full connection string |
201 | + connStr = data.conn_string |
202 | + if data.password: |
203 | + if '%s' not in data.conn_string: |
204 | + connStr += ';PWD=%s' |
205 | + connStr = connStr % data.password |
206 | + #Try to connect |
207 | + if data.connector == 'cx_Oracle': |
208 | + os.environ['NLS_LANG'] = 'AMERICAN_AMERICA.UTF8' |
209 | + conn = cx_Oracle.connect(connStr) |
210 | + elif data.connector == 'pyodbc': |
211 | + conn = pyodbc.connect(connStr) |
212 | + elif data.connector in ('sqlite', 'mysql', 'mssql'): |
213 | + conn = sqlalchemy.create_engine(connStr).connect() |
214 | + elif data.connector == 'postgresql': |
215 | + conn = psycopg2.connect(connStr) |
216 | + |
217 | + return conn |
218 | + |
219 | + def execute(self, cr, uid, ids, sqlquery, sqlparams=None, metadata=False, |
220 | + context=None): |
221 | + """ |
222 | + Executes SQL and returns a list of rows. |
223 | + `sqlparams` can be a dict of values, that can be referenced in the SQL |
224 | + statement using "%(key)s" or, in the case of Oracle, ":key". |
225 | + Example: |
226 | + sqlquery = "select * from mytable " |
227 | + "where city = %(city)s and date > %(dt)s" |
228 | + params = {'city': 'Lisbon', 'dt': datetime.datetime(2000, 12, 31)} |
229 | + If `metadata==True`, it will instead return a dict containing the |
230 | + rows list and the columns list, in the format: |
231 | + { 'cols': [ 'col_a', 'col_b', ...] |
232 | + , 'rows': [ (a0, b0, ...), (a1, b1, ...), ...] } |
233 | + """ |
234 | + sqlparams = sqlparams or [] |
235 | + data = self.browse(cr, uid, ids) |
236 | + rows, cols = list(), list() |
237 | + for obj in data: |
238 | + conn = self.conn_open(cr, uid, obj.id) |
239 | + if obj.connector in ["sqlite", "mysql", "mssql"]: |
240 | + #using sqlalchemy |
241 | + cur = conn.execute(sqlquery, sqlparams) |
242 | + if metadata: |
243 | + cols = cur.keys() |
244 | + rows = [r for r in cur] |
245 | + else: |
246 | + #using other db connectors |
247 | + cur = conn.cursor() |
248 | + cur.execute(sqlquery, sqlparams) |
249 | + if metadata: |
250 | + cols = [d[0] for d in cur.description] |
251 | + rows = cur.fetchall() |
252 | + conn.close() |
253 | + if metadata: |
254 | + return{'cols': cols, 'rows': rows} |
255 | + else: |
256 | + return rows |
257 | + |
258 | + def connection_test(self, cr, uid, ids, context=None): |
259 | + """Test a connection. Returns an os""" |
260 | + for obj in self.browse(cr, uid, ids, context): |
261 | + conn = False |
262 | + try: |
263 | + conn = self.conn_open(cr, uid, obj.id) |
264 | + except Exception, e: |
265 | + raise orm.except_orm( |
266 | + _("Connection test failed!"), |
267 | + _("Here is what we got instead:\n %s") % tools.ustr(e)) |
268 | + finally: |
269 | + try: |
270 | + if conn: |
271 | + conn.close() |
272 | + except Exception: |
273 | + # ignored, just a consequence of the previous exception |
274 | + pass |
275 | + #TODO: if OK a (wizard) message box should be displayed |
276 | + raise orm.except_orm( |
277 | + _("Connection test succeeded!"), |
278 | + _("Everything seems properly set up!")) |
279 | |
280 | === added file 'base_external_dbsource/base_external_dbsource_demo.xml' |
281 | --- base_external_dbsource/base_external_dbsource_demo.xml 1970-01-01 00:00:00 +0000 |
282 | +++ base_external_dbsource/base_external_dbsource_demo.xml 2014-01-24 13:37:33 +0000 |
283 | @@ -0,0 +1,13 @@ |
284 | +<?xml version="1.0"?> |
285 | +<openerp> |
286 | + <data> |
287 | + |
288 | + <record model="base.external.dbsource" id="demo_postgre"> |
289 | + <field name="name">PostgreSQL local</field> |
290 | + <field name="conn_string">dbname='postgres' password=%s</field> |
291 | + <field name="password">postgresql</field> |
292 | + <field name="connector">postgresql</field> |
293 | + </record> |
294 | + |
295 | + </data> |
296 | +</openerp> |
297 | |
298 | === added file 'base_external_dbsource/base_external_dbsource_view.xml' |
299 | --- base_external_dbsource/base_external_dbsource_view.xml 1970-01-01 00:00:00 +0000 |
300 | +++ base_external_dbsource/base_external_dbsource_view.xml 2014-01-24 13:37:33 +0000 |
301 | @@ -0,0 +1,50 @@ |
302 | +<?xml version="1.0"?> |
303 | +<openerp> |
304 | + <data> |
305 | + |
306 | + <record model="ir.ui.view" id="view_dbsource_tree"> |
307 | + <field name="name">base.external.dbsource.tree</field> |
308 | + <field name="model">base.external.dbsource</field> |
309 | + <field name="type">tree</field> |
310 | + <field name="arch" type="xml"> |
311 | + <tree string="External DB Sources"> |
312 | + <field name="name"/> |
313 | + <field name="connector"/> |
314 | + <field name="conn_string"/> |
315 | + </tree> |
316 | + </field> |
317 | + </record> |
318 | + |
319 | + <record model="ir.ui.view" id="view_dbsource_form"> |
320 | + <field name="name">base.external.dbsource.form</field> |
321 | + <field name="model">base.external.dbsource</field> |
322 | + <field name="type">form</field> |
323 | + <field name="arch" type="xml"> |
324 | + <form string="External DB Source"> |
325 | + <field name="name"/> |
326 | + <field name="connector"/> |
327 | + <field name="conn_string"/> |
328 | + <field name="password" password="True"/> |
329 | + <button name="connection_test" string="Test Connection" |
330 | + type="object" icon="gtk-network"/> |
331 | + </form> |
332 | + </field> |
333 | + </record> |
334 | + |
335 | + <record model="ir.actions.act_window" id="action_dbsource"> |
336 | + <field name="name">External Database Sources</field> |
337 | + <field name="res_model">base.external.dbsource</field> |
338 | + <field name="view_type">form</field> |
339 | + <field name="view_mode">tree,form</field> |
340 | + <field name="view_id" ref="view_dbsource_tree"/> |
341 | + </record> |
342 | + |
343 | + <menuitem name="Database Sources" |
344 | + id="menu_dbsource" |
345 | + parent="base.next_id_9" |
346 | + action="action_dbsource"/> |
347 | + |
348 | + </data> |
349 | +</openerp> |
350 | + |
351 | + |
352 | |
353 | === added directory 'base_external_dbsource/images' |
354 | === added file 'base_external_dbsource/images/screenshot01.png' |
355 | Binary 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 |
356 | === added directory 'base_external_dbsource/security' |
357 | === added file 'base_external_dbsource/security/ir.model.access.csv' |
358 | --- base_external_dbsource/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 |
359 | +++ base_external_dbsource/security/ir.model.access.csv 2014-01-24 13:37:33 +0000 |
360 | @@ -0,0 +1,2 @@ |
361 | +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
362 | +access_base_external_dbsource_group_system,bae_external_dbsource_group_system,model_base_external_dbsource,base.group_system,1,1,1,1 |
363 | |
364 | === added directory 'base_external_dbsource/test' |
365 | === added file 'base_external_dbsource/test/dbsource_connect.yml' |
366 | --- base_external_dbsource/test/dbsource_connect.yml 1970-01-01 00:00:00 +0000 |
367 | +++ base_external_dbsource/test/dbsource_connect.yml 2014-01-24 13:37:33 +0000 |
368 | @@ -0,0 +1,5 @@ |
369 | +- |
370 | + Connect to local Postgres. |
371 | +- |
372 | + !python {model: base.external.dbsource}: | |
373 | + self.connection_test(cr, uid, [ref("demo_postgre")]) |
LGTM