1
# -*- encoding: utf-8 -*-
2
###########################################################################
3
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
8
############################################################################
9
# Coded by: julio (julio@vauxoo.com)
10
############################################################################
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.
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.
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/>.
25
##############################################################################
30
import openerp.netsvc as netsvc
31
from openerp.tools.translate import _
33
import openerp.tools as tools
35
from openerp.osv import osv, fields
38
class wizard_import(osv.TransientModel):
39
_name = 'wizard.import'
41
'name': fields.binary('File'),
42
'msg': fields.text('Messages', readonly=True),
43
'validate': fields.boolean('Validate?')
46
def send_lines(self, cr, uid, ids, context=None):
49
form = self.read(cr, uid, ids, [])
50
order_id = context.get('active_id', False)
51
fdata = form and base64.decodestring(form[0]['name']) or False
52
fvalidate = form and form[0]['validate'] or False
53
msg = self.pool.get('sale.order').import_data_line(
54
cr, uid, order_id, fdata, fvalidate, context=context)
56
self.write(cr, uid, ids, {'msg': msg})