parent
0e284b43d1
commit
469583a2a3
|
@ -0,0 +1,50 @@
|
|||
diff --git a/trytond/trytond/tests/test_tryton.py b/trytond/trytond/tests/test_tryton.py
|
||||
index 864db291..a3c44848 100644
|
||||
--- a/trytond/trytond/tests/test_tryton.py
|
||||
+++ b/trytond/trytond/trytond/tests/test_tryton.py
|
||||
@@ -24,14 +24,15 @@ from sql import Table
|
||||
|
||||
from trytond.pool import Pool, isregisteredby
|
||||
from trytond import backend
|
||||
-from trytond.model import Workflow, ModelSQL, ModelSingleton, ModelView, fields
|
||||
+from trytond.model import (
|
||||
+ Workflow, ModelSQL, ModelStorage, ModelSingleton, ModelView, fields)
|
||||
from trytond.model.fields import get_eval_fields, Function
|
||||
from trytond.tools import is_instance_method, file_open
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.cache import Cache
|
||||
from trytond.config import config, parse_uri
|
||||
from trytond.wizard import StateView, StateAction
|
||||
-from trytond.pyson import PYSONDecoder
|
||||
+from trytond.pyson import PYSONDecoder, PYSONEncoder
|
||||
|
||||
__all__ = ['DB_NAME', 'USER', 'CONTEXT',
|
||||
'activate_module', 'ModuleTestCase', 'with_transaction',
|
||||
@@ -513,6 +514,27 @@ class ModuleTestCase(unittest.TestCase):
|
||||
Target,
|
||||
msg='Missing target for "%s"."%s"' % (mname, fname))
|
||||
|
||||
+ @with_transaction()
|
||||
+ def test_field_relation_domain(self):
|
||||
+ "Test domain of relation fields"
|
||||
+ pool = Pool()
|
||||
+ for mname, model in pool.iterobject():
|
||||
+ if not isregisteredby(model, self.module):
|
||||
+ continue
|
||||
+ for fname, field in model._fields.items():
|
||||
+ if not field.domain:
|
||||
+ continue
|
||||
+ if hasattr(field, 'get_target'):
|
||||
+ Target = field.get_target()
|
||||
+ else:
|
||||
+ continue
|
||||
+ if not issubclass(Target, ModelStorage):
|
||||
+ continue
|
||||
+ with self.subTest(model=mname, field=fname):
|
||||
+ domain = PYSONDecoder({}).decode(
|
||||
+ PYSONEncoder().encode(field.domain))
|
||||
+ Target.search(domain, limit=1)
|
||||
+
|
||||
@with_transaction()
|
||||
def test_menu_action(self):
|
||||
'Test that menu actions are accessible to menu\'s group'
|
1
series
1
series
|
@ -1,5 +1,6 @@
|
|||
babi_multiprocess.diff # [trytond] babi multiprocess
|
||||
trytond_test_database.diff # [trytond] avoid errors on upgrades from version 3.4
|
||||
issue10794.diff # [trytond] Add test on domain of relation fields
|
||||
|
||||
issue3932.diff # [account] rule account move and account move line by company
|
||||
tax_update_unit_price.diff # [account] Add the update_unit_price control on parent tax
|
||||
|
|
Loading…
Reference in New Issue