~openerp-commiter/openobject-addons/extra-6.0

« back to all changes in this revision

Viewing changes to etl_interface/etl_connector/openobject_connector.py

  • Committer: Harry (Open ERP)
  • Date: 2009-03-18 12:51:34 UTC
  • mto: (3589.27.39 extra)
  • mto: This revision was merged to the branch mainline in revision 3595.
  • Revision ID: hmo@tinyerp.com-20090318125134-ywp6lsse5u9ffcbs
[ETL] etl_interface : new module for etl interface with openerp

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# -*- encoding: utf-8 -*-
 
3
##############################################################################
 
4
#
 
5
#    OpenERP, Open Source Management Solution
 
6
#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 
7
#    $Id$
 
8
#
 
9
#    This program is free software: you can redistribute it and/or modify
 
10
#    it under the terms of the GNU General Public License as published by
 
11
#    the Free Software Foundation, either version 3 of the License, or
 
12
#    (at your option) any later version.
 
13
#
 
14
#    This program is distributed in the hope that it will be useful,
 
15
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
#    GNU General Public License for more details.
 
18
#
 
19
#    You should have received a copy of the GNU General Public License
 
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
#
 
22
##############################################################################
 
23
import etl
 
24
import tools
 
25
from osv import osv, fields
 
26
 
 
27
class etl_connector_openobject(osv.osv):
 
28
    _name='etl.connector'
 
29
    _inherit='etl.connector'
 
30
    
 
31
    _columns={
 
32
              'uri' : fields.char('URL Path', size=64), 
 
33
              'db' : fields.char('Database', size=64), 
 
34
              'login' : fields.char('Login Name', size=64), 
 
35
              'passwd' : fields.char('Password', size=64), 
 
36
              'obj' : fields.char('Object', size=64), 
 
37
              'con_type' : fields.char('Connection Type', size=64), 
 
38
    }
 
39
    
 
40
    
 
41
    def onchange_type(self, cr, uid,ids, type):
 
42
        res=super(etl_connector_openobject, self).onchange_type(cr,uid,ids,type)
 
43
        val=res.get('value',{})
 
44
        if type and type=='openobject_connector':
 
45
            val['obj']= '/xmlrpc/object'
 
46
            val['con_type']= 'xmlrpc'                
 
47
        return {'value':val}
 
48
        
 
49
    def create_instance(self, cr, uid, id , context={}):
 
50
        val = super(etl_connector_openobject, self).create_instance(cr, uid, id, context)
 
51
        con=self.browse(cr, uid, id)
 
52
        if con.type == 'openobject_connector':
 
53
            val = etl.connector.openobject_connector(con.uri, cr.dbname, con.login, con.passwd, con.obj, con.con_type) 
 
54
        return val
 
55
        
 
56
etl_connector_openobject()
 
57
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
58