summaryrefslogtreecommitdiff
path: root/odoo/addons/test_new_api/tests/test_schema.py
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2019-01-25 15:04:42 +0000
committerMartin Trigaux <mat@odoo.com>2019-08-19 11:44:34 +0000
commit7593b887dff4fcd474ca72aead6825481b419d86 (patch)
tree28c5445d1440701de5c7534e1d8accef222798d8 /odoo/addons/test_new_api/tests/test_schema.py
parenta248171d96de3ad6d8e22c855886dfae61e145e2 (diff)
[REF] fields: use ir.model.fields.selection
The selection values of a selection field are now stored in database in the model ir.model.fields.selection This will allow to have a modular approche on selections and each selection is now linked to the module that declared it. Previously to this change, the selections were linked to the field, meaning uninstalling a module had no impact on the selections stored on database. With this change, the selections will now be translated in the correct module (having an external id) and the records having a used selection will now be reset to null. closes odoo/odoo#30228 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com> Co-authored-by: Raphaƫl Collet <rco@odoo.com>
Diffstat (limited to 'odoo/addons/test_new_api/tests/test_schema.py')
-rw-r--r--odoo/addons/test_new_api/tests/test_schema.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/odoo/addons/test_new_api/tests/test_schema.py b/odoo/addons/test_new_api/tests/test_schema.py
index 6e79da8f362..6ede0e833d5 100644
--- a/odoo/addons/test_new_api/tests/test_schema.py
+++ b/odoo/addons/test_new_api/tests/test_schema.py
@@ -44,6 +44,12 @@ class TestReflection(common.TransactionCase):
relation = self.env['ir.model.relation'].search([('name', '=', field.relation)])
self.assertTrue(relation)
self.assertIn(relation.model.model, [field.model_name, field.comodel_name])
+ if field.type == 'selection':
+ selection = [(sel.value, sel.name) for sel in ir_field.selection_ids]
+ if isinstance(field.selection, list):
+ self.assertEqual(selection, field.selection)
+ else:
+ self.assertEqual(selection, [])
class TestSchema(common.TransactionCase):