1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
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.
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.
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/>.
20
##############################################################################
22
""" Modules (also called addons) management.
25
import openerp.tools as tools
27
from openerp.tools import assertion_report
30
from openerp.osv import osv, fields
32
class test_yaml_data(osv.osv_memory):
34
_name = 'test.yaml.data'
37
'yaml_file': fields.binary('File sale order worng'),
38
'yaml_file_log': fields.binary('File Log'),
39
'filename': fields.char('File name', size=128, readonly=True, help='This is File name'),
40
'filename_log': fields.char('File name log', size=128, readonly=True),
43
def test_sale (self, cr, uid, ids, context=None):
45
assertion_obj = assertion_report.assertion_report()
46
this = self.browse(cr, uid, ids)[0]
47
fp_data = tools.file_open(os.path.join('sale_test_data', 'test/sale_order_test_data.xml'))
48
fp_test = tools.file_open(os.path.join('sale_test_data', 'test/sale_order_product_can_be_sold.yml'))
50
cr.execute("SAVEPOINT test_yaml_sale_savepoint")
51
tools.convert_xml_import(cr, 'sale_test_data', fp_data , {}, 'init', False, assertion_obj)
52
tools.convert_yaml_import(cr, 'sale_test_data', fp_test ,'test', {}, 'init', False, assertion_obj)
55
cr.execute("RELEASE SAVEPOINT test_yaml_sale_savepoint")
57
cr.execute("ROLLBACK TO test_yaml_sale_savepoint")
60
if tools.config['test_report_directory']:
61
file_sale_order_wrong = base64.encodestring(open(os.path.join(tools.config['test_report_directory'], 'product_sale_order_wrong.csv'), 'rb+').read())
62
file_sale_order_log = base64.encodestring(open(os.path.join(tools.config['test_report_directory'], 'product_sale_order_LOG.csv'), 'rb+').read())
64
self.write(cr, uid, ids, {
65
'yaml_file': file_sale_order_wrong,
66
'yaml_file_log' : file_sale_order_log,
67
'filename': 'product_sale_order_wrong.csv',
68
'filename_log' : 'product_sale_order_LOG.csv',
71
__, xml_id = self.pool.get('ir.model.data').get_object_reference(
72
cr, uid, 'sale_test_data', 'view_wizard_sale_test_data_result')
75
'res_model': 'test.yaml.data',
81
'type': 'ir.actions.act_window',