[REM] core: remove test_documentation_examples module
The only purpose of the module `test_documentation_examples` is to test a few of the code examples shown in the developer documentation. As d4ba3117524 removes the documentation sources from the repository, the test module is removed as well. DOC PR: https://github.com/odoo/documentation-user/pull/945 task-2352371 closes odoo/odoo#70256 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com> Co-authored-by: Victor Feyens <vfe@odoo.com> Co-authored-by: Antoine Vandevenne <anv@odoo.com>
This commit is contained in:
committed by
Antoine Vandevenne (anv)
co-authored by
Antoine Vandevenne
parent
609082da2f
commit
0cefdf9d87
@@ -1,6 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import inheritance
|
||||
from . import extension
|
||||
from . import delegation
|
||||
@@ -1,16 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': "Documentation examples test",
|
||||
'description': """
|
||||
Contains pieces of code to be used as technical documentation examples
|
||||
(via the ``literalinclude`` directive) in situations where they can be
|
||||
syntax-checked and tested.
|
||||
""",
|
||||
|
||||
'category': 'Hidden/Tests',
|
||||
'version': '0.1',
|
||||
'data': [
|
||||
'ir.model.access.csv',
|
||||
],
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
class Screen(models.Model):
|
||||
_name = 'delegation.screen'
|
||||
_description = 'Screen'
|
||||
|
||||
size = fields.Float(string='Screen Size in inches')
|
||||
|
||||
class Keyboard(models.Model):
|
||||
_name = 'delegation.keyboard'
|
||||
_description = 'Keyboard'
|
||||
|
||||
layout = fields.Char(string='Layout')
|
||||
|
||||
class Laptop(models.Model):
|
||||
_name = 'delegation.laptop'
|
||||
_description = 'Laptop'
|
||||
|
||||
_inherits = {
|
||||
'delegation.screen': 'screen_id',
|
||||
'delegation.keyboard': 'keyboard_id',
|
||||
}
|
||||
|
||||
name = fields.Char(string='Name')
|
||||
maker = fields.Char(string='Maker')
|
||||
|
||||
# a Laptop has a screen
|
||||
screen_id = fields.Many2one('delegation.screen', required=True, ondelete="cascade")
|
||||
# a Laptop has a keyboard
|
||||
keyboard_id = fields.Many2one('delegation.keyboard', required=True, ondelete="cascade")
|
||||
@@ -1,15 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
class Extension0(models.Model):
|
||||
_name = 'extension.0'
|
||||
_description = 'Extension zero'
|
||||
|
||||
name = fields.Char(default="A")
|
||||
|
||||
class Extension1(models.Model):
|
||||
_inherit = 'extension.0'
|
||||
|
||||
description = fields.Char(default="Extended")
|
||||
@@ -1,24 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
class Inheritance0(models.Model):
|
||||
_name = 'inheritance.0'
|
||||
_description = 'Inheritance Zero'
|
||||
|
||||
name = fields.Char()
|
||||
|
||||
def call(self):
|
||||
return self.check("model 0")
|
||||
|
||||
def check(self, s):
|
||||
return "This is {} record {}".format(s, self.name)
|
||||
|
||||
class Inheritance1(models.Model):
|
||||
_name = 'inheritance.1'
|
||||
_inherit = 'inheritance.0'
|
||||
_description = 'Inheritance One'
|
||||
|
||||
def call(self):
|
||||
return self.check("model 1")
|
||||
@@ -1,7 +0,0 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_inheritance_0,access_inheritance_0,model_inheritance_0,,1,1,1,1
|
||||
access_inheritance_1,access_inheritance_1,model_inheritance_1,,1,1,1,1
|
||||
access_extension_0,access_extension_0,model_extension_0,,1,1,1,1
|
||||
access_delegation_screen,access_delegation_screen,model_delegation_screen,,1,1,1,1
|
||||
access_delegation_keyboard,access_delegation_keyboard,model_delegation_keyboard,,1,1,1,1
|
||||
access_delegation_laptop,access_delegation_laptop,model_delegation_laptop,,1,1,1,1
|
||||
|
@@ -1,4 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_inheritance, test_extension, test_delegation
|
||||
@@ -1,47 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.tests import common
|
||||
|
||||
class TestDelegation(common.TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestDelegation, self).setUp()
|
||||
env = self.env
|
||||
record = env['delegation.laptop'].create({
|
||||
'screen_id': env['delegation.screen'].create({'size': 13.0}).id,
|
||||
'keyboard_id': env['delegation.keyboard'].create({'layout': 'QWERTY'}).id,
|
||||
})
|
||||
self.record = record
|
||||
|
||||
def test_delegating_record(self):
|
||||
env = self.env
|
||||
record = self.record
|
||||
|
||||
# children fields can be looked up on the parent record directly
|
||||
self.assertEqual(
|
||||
record.size
|
||||
,
|
||||
13.0
|
||||
)
|
||||
self.assertEqual(
|
||||
record.layout
|
||||
,
|
||||
'QWERTY'
|
||||
)
|
||||
|
||||
def test_swap_child(self):
|
||||
env = self.env
|
||||
record = self.record
|
||||
|
||||
record.write({
|
||||
'screen_id': env['delegation.screen'].create({'size': 17.0}).id
|
||||
})
|
||||
self.assertEqual(record.size, 17.0)
|
||||
|
||||
def test_write(self):
|
||||
record = self.record
|
||||
|
||||
record.write({'size': 14.0})
|
||||
self.assertEqual(record.size, 14.0)
|
||||
self.assertEqual(record.screen_id.size, 14.0)
|
||||
@@ -1,17 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# 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):
|
||||
env = self.env
|
||||
|
||||
record = env['extension.0'].create({})
|
||||
|
||||
reference =\
|
||||
{'name': "A", 'description': "Extended"}
|
||||
values =\
|
||||
record.read()[0]
|
||||
|
||||
self.assertLess(reference.items(), values.items())
|
||||
@@ -1,22 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# 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):
|
||||
env = self.env
|
||||
|
||||
a = env['inheritance.0'].create({'name': 'A'})
|
||||
b = env['inheritance.1'].create({'name': 'B'})
|
||||
|
||||
self.assertEqual(
|
||||
a.call()
|
||||
,
|
||||
"This is model 0 record A"
|
||||
)
|
||||
self.assertEqual(
|
||||
b.call()
|
||||
,
|
||||
"This is model 1 record B"
|
||||
)
|
||||
Reference in New Issue
Block a user