Skip to Content
Menu
This question has been flagged
3 Replies
3343 Views

Hi,

Running a simple form test in a new addon with sale_timesheet addon dependency results in:

 # simple test form code
with Form(self.env['project.task']) as task_form:
    task_form.name = "Test Task Form"

# Error during test run
AssertionError: This domain is syntactically not correct: ['|', ['partner_id', '=', False]]


This domain is defined in sale_timesheet addon in Odoo 12 (and 13):

https://github.com/odoo/odoo/blob/be8a670ec8652160f5e7e6f1bc4eb78fb8548a52/addons/sale_timesheet/views/project_task_views.xml#L65


Running the form test in my new addon without sale_timesheet dependency no error occurs.


Question: Is  ['|', ['partner_id', '=', False]] a valid domain or is this an error of the serverside form testing implementation?


Here is the complete error of the test run:


# Traceback

====================================================================== 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: FAIL: test_create_task_with_context (odoo.addons.<my_addon_name>.tests.test_model_project_task.TestProjectTask) 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: Traceback (most recent call last): 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` File "/mnt/extra-addons/<my_addon_name>/tests/test_model_project_task.py", line 88, in test_create_task_with_context 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` with Form(Task) as task_form: 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` File "/usr/lib/python3/dist-packages/odoo/tests/common.py", line 1141, in __init__ 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` self._process_fvg(recordp, fvg) 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` File "/usr/lib/python3/dist-packages/odoo/tests/common.py", line 1213, in _process_fvg 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` for modifier, domain in json.loads(f.get('modifiers', '{}')).items() 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` File "/usr/lib/python3/dist-packages/odoo/tests/common.py", line 1213, in <dictcomp> 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` for modifier, domain in json.loads(f.get('modifiers', '{}')).items() 2020-04-13 18:22:48,395 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` File "/usr/lib/python3/dist-packages/odoo/osv/expression.py", line 207, in normalize_domain 2020-04-13 18:22:48,396 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` assert expected == 0, 'This domain is syntactically not correct: %s' % (domain) 2020-04-13 18:22:48,396 1 ERROR odoo odoo.addons.<my_addon_name>.tests.test_model_project_task: ` AssertionError: This domain is syntactically not correct: ['|', ['partner_id', '=', False]]




Avatar
Discard
Best Answer

I think that domain is not correct because the '|' should be followed by two OR conditions, like this:

["|",
   ["purchase_ok","=",True],
   ["sale_ok","=",True]
]
https://odootricks.tips/domain-in-odoo/

Avatar
Discard
Author

Thank you. I'll create a MR.

Found similar domains in event and mail addon

Author Best Answer

Maybe somebody is interested to support/approve my MR on https://github.com/odoo/odoo/pull/49546

Thank you

Avatar
Discard
Related Posts Replies Views Activity
0
Aug 21
3
0
Jan 21
985
5
Jul 19
3510
3
May 18
3563
1
May 16
2707