Skip to content
Snippets Groups Projects
Commit 94e82753 authored by Raphael Collet's avatar Raphael Collet
Browse files

[MIG] test_documentation_examples: convert code to the new API

parent 64b77b1a
Branches
Tags
No related merge requests found
# -*- coding: utf-8 -*-
import inheritance
import extension
import delegation
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import inheritance
from . import extension
from . import delegation
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': "Documentation examples test",
'description': """
......
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields
from odoo import models, fields
class Child0(models.Model):
_name = 'delegation.child0'
......
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields
from odoo import models, fields
class Extension0(models.Model):
_name = 'extension.0'
......
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields
from odoo import models, fields
class Inheritance0(models.Model):
_name = 'inheritance.0'
......
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_inheritance, test_extension, test_delegation
# -*- coding: utf-8 -*-
from openerp.tests import common
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class TestDelegation(common.TransactionCase):
......@@ -17,16 +19,8 @@ class TestDelegation(common.TransactionCase):
record = self.record
# children fields can be looked up on the parent record directly
self.assertEqual(
record.field_0
,
0
)
self.assertEqual(
record.field_1
,
1
)
self.assertEqual(record.field_0, 0)
self.assertEqual(record.field_1, 1)
def test_swap_child(self):
env = self.env
......@@ -35,23 +29,11 @@ class TestDelegation(common.TransactionCase):
record.write({
'child0_id': env['delegation.child0'].create({'field_0': 42}).id
})
self.assertEqual(
record.field_0
,
42
)
self.assertEqual(record.field_0, 42)
def test_write(self):
record = self.record
record.write({'field_1': 4})
self.assertEqual(
record.field_1
,
4
)
self.assertEqual(
record.child1_id.field_1
,
4
)
self.assertEqual(record.field_1, 4)
self.assertEqual(record.child1_id.field_1, 4)
# -*- coding: utf-8 -*-
from openerp.tests import common
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class TestBasicInheritance(common.TransactionCase):
def test_extend_fields(self):
......
# -*- coding: utf-8 -*-
from openerp.tests import common
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class TestBasicInheritance(common.TransactionCase):
def test_inherit_method(self):
......@@ -8,17 +10,5 @@ class TestBasicInheritance(common.TransactionCase):
a = env['inheritance.0'].create({'name': 'A'})
b = env['inheritance.1'].create({'name': 'B'})
self.assertEqual(
a.call()
,
"""
This is model 0 record A
""".strip()
)
self.assertEqual(
b.call()
,
"""
This is model 1 record B
""".strip()
)
self.assertEqual(a.call(), "This is model 0 record A")
self.assertEqual(b.call(), "This is model 1 record B")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment