Browse Source

[MIG] test_configuration_helper: Migration to 11.0

pull/1261/head
Akim Juillerat 6 years ago
parent
commit
5819e1ca5d
  1. 10
      test_configuration_helper/__manifest__.py
  2. 26
      test_configuration_helper/models.py
  3. 17
      test_configuration_helper/tests/test_config.py

10
test_configuration_helper/__manifest__.py

@ -1,16 +1,12 @@
# -*- coding: utf-8 -*-
# © 2016 Yannick Vaucher (Camptocamp SA)
# Copyright 2016 Yannick Vaucher (Camptocamp SA)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{'name': 'Configuration Helper - Tests',
'version': '9.0.1.0.0',
'version': '11.0.1.0.0',
'author': "Akretion,Odoo Community Association (OCA)",
'maintainer': 'Akretion',
'category': 'Tests',
'complexity': 'normal',
'depends': ['configuration_helper'],
'website': 'http://www.akretion.com/',
'data': [],
'tests': [],
'website': 'https://github.com/OCA/server-tools',
'installable': False,
'auto_install': False,
'license': 'AGPL-3',

26
test_configuration_helper/models.py

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
# © 2016 Yannick Vaucher (Camptocamp SA)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models, osv
from odoo import fields, models
class ResCompanyA(models.Model):
class ResCompany(models.Model):
_inherit = 'res.company'
prefix_a_name = fields.Char()
@ -12,25 +11,8 @@ class ResCompanyA(models.Model):
prefix_a_partner_id = fields.Many2one(comodel_name='res.partner')
class ResCompanyB(models.Model):
_inherit = 'res.company'
_columns = {
'prefix_b_name': osv.fields.char('name'),
'prefix_b_integer': osv.fields.integer('int'),
'prefix_b_partner_id': osv.fields.many2one('res.partner'),
}
class MyConfigA(models.TransientModel):
_name = 'a.config.settings'
_inherit = ['res.config.settings', 'abstract.config.settings']
_prefix = 'prefix_a_'
_companyObject = ResCompanyA
class MyConfigB(models.TransientModel):
_name = 'b.config.settings'
_inherit = ['res.config.settings', 'abstract.config.settings']
_prefix = 'prefix_b_'
_companyObject = ResCompanyB
_prefix = 'prefix_a_'
_companyObject = ResCompany

17
test_configuration_helper/tests/test_config.py

@ -1,18 +1,18 @@
# -*- coding: utf-8 -*-
# © 2016 Yannick Vaucher (Camptocamp SA)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import openerp.tests.common as common
import odoo.tests.common as common
class TestAbstractSettings(common.TransactionCase):
def setUp(self):
import pdb; pdb.set_trace()
super(TestAbstractSettings, self).setUp()
self.partner_id = self.ref('base.res_partner_12')
self.company = self.env.ref('base.main_company')
def test_config(self):
wiz = self.env['a.config.settings'].create({})
wiz = self.env['res.config.settings'].create({})
wiz.name = 'Toto'
wiz.integer = 11
wiz.partner_id = self.partner_id
@ -21,14 +21,3 @@ class TestAbstractSettings(common.TransactionCase):
self.assertEqual(self.company.prefix_a_name, wiz.name)
self.assertEqual(self.company.prefix_a_integer, wiz.integer)
self.assertEqual(self.company.prefix_a_partner_id, wiz.partner_id)
def test_config_old_api(self):
wiz = self.env['b.config.settings'].create({})
wiz.name = 'Toto'
wiz.integer = 11
wiz.partner_id = self.partner_id
wiz.execute()
self.assertEqual(self.company.prefix_b_name, wiz.name)
self.assertEqual(self.company.prefix_b_integer, wiz.integer)
self.assertEqual(self.company.prefix_b_partner_id, wiz.partner_id)
Loading…
Cancel
Save