test_inherit_depends.py 764 B

123456789101112131415161718
  1. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  2. from odoo.tests import common
  3. class TestInheritDepends(common.TransactionCase):
  4. def test_inherited_field_external_id(self):
  5. # Module A defines model M, module B defines a mixin (abstract model) X,
  6. # and module C extends M to inherit from X. The fields on M inherited
  7. # from X should have an external ID in module C.
  8. #
  9. # Here, M is 'test_new_api.foo' and X is 'test_inherit.mixin'.
  10. field = self.env['ir.model.fields']._get('test_new_api.foo', 'published')
  11. self.assertTrue(field)
  12. self.assertEqual(field._get_external_ids(), {
  13. field.id: ['test_inherit_depends.field_test_new_api_foo__published'],
  14. })