2
# -*- encoding: utf-8 -*-
3
##############################################################################
5
# OpenERP, Open Source Management Solution
6
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
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.
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.
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/>.
22
##############################################################################
25
from osv import osv, fields
27
class etl_component_csv_in(osv.osv):
29
_inherit = 'etl.component'
32
'connector_id' : fields.many2one('etl.connector', 'Connector', domain="[('type','=','localfile')]"),
33
'row_limit' : fields.integer('Limit'),
34
'csv_params' : fields.char('CSV Parameters', size=64),
37
'csv_params':lambda *x:'{}'
41
def create_instance(self, cr, uid, id, context={}):
42
val=super(etl_component_csv_in, self).create_instance(cr, uid, id, context)
43
obj_connector=self.pool.get('etl.connector')
44
obj_transformer = self.pool.get('etl.transformer')
45
cmp=self.browse(cr, uid, id)
46
if cmp.type_id.name=='input.csv_in':
47
conn_instance=trans_instance=False
49
conn_instance=obj_connector.get_instance(cr, uid, cmp.connector_id.id , context)
50
if cmp.transformer_id:
51
trans_instance=obj_transformer.get_instance(cr, uid, cmp.transformer_id.id, context)
53
val =etl.component.input.csv_in(conn_instance, 'component.input.csv_in', trans_instance, cmp.row_limit, cmp.csv_params and eval(cmp.csv_params) or {})
58
etl_component_csv_in()
59
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: