[18.0][BUG] web_pivot_computed_measure: unit tests fail and cause another module migration to fail

Open
#3,039 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, python

Research direction

Start with web_pivot_computed_measure/tests/test_ui_pivot.py and its browser tour, then inspect the failing PivotModel.addComputedMeasure call shown in the trace. Reproduce the UI test with websocket-client installed and check how the test handles the modal and computed measure. Done means the module's tests pass and the reported missing res_users fields are no longer queried during the migration.

Written by the indexing model from the issue text.

Description

bug stale

Module

web_pivot_computed_measure

Describe the bug

I am trying to add migration PR #3037 for web_responsive, I got an error that these fields: user_year_born, user_year_now do not exist.

`2024-12-24 18:00:42,135 250 INFO odoo odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot.TestUIPivot.test_ui: waiting for threads: []
2024-12-24 18:00:42,136 250 INFO odoo odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot: ======================================================================
2024-12-24 18:00:42,136 250 ERROR odoo odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot: FAIL: TestUIPivot.test_ui
Traceback (most recent call last):
File "/__w/web/web/web_pivot_computed_measure/tests/test_ui_pivot.py", line 32, in test_ui
self.start_tour(
File "/opt/odoo/odoo/tests/common.py", line 2076, in start_tour
return self.browser_js(url_path=url_path, code=code, ready=ready, timeout=timeout, success_signal="tour succeeded", **kwargs)
File "/opt/odoo/odoo/tests/common.py", line 2052, in browser_js
self.fail('%s\n\n%s' % (message, error))
AssertionError: The test code "odoo.startTour('web_pivot_computed_measure_tour', {"stepDelay": 100, "keepWatchBrowser": false, "debug": false, "startUrl": "/odoo", "delayToCheckUndeterminisms": 0})" failed

FAILED: [1/18] Tour web_pivot_computed_measure_tour → Step .o_navbar_apps_menu button.
Element has been found.
BUT: It is not allowed to do action on an element that's below a modal.
TIMEOUT: The step failed to complete within 10100 ms.

2024-12-24 18:00:42,197 250 INFO odoo odoo.addons.base.models.ir_attachment: filestore gc 34 checked, 2 removed
2024-12-24 18:00:42,208 250 INFO odoo odoo.addons.web_responsive.tests.test_ir_http: Starting TestIrHttp.test_session_info ...
2024-12-24 18:00:42,213 250 ERROR odoo odoo.sql_db: bad query: b'SELECT "res_users"."id", "res_users"."partner_id", "res_users"."login", "res_users"."signature", "res_users"."active", "res_users"."action_id", "res_users"."share", "res_users"."company_id", "res_users"."create_uid", "res_users"."create_date", "res_users"."write_uid", "res_users"."write_date", "res_users"."tour_enabled", "res_users"."notification_type", "res_users"."odoobot_state", "res_users"."odoobot_failed", "res_users"."apps_menu_search_type", "res_users"."apps_menu_theme", "res_users"."is_redirect_home", "res_users"."user_year_born", "res_users"."user_year_now" FROM "res_users" WHERE ("res_users"."id" IN (2))'
ERROR: column res_users.user_year_born does not exist
LINE 1: ...apps_menu_theme", "res_users"."is_redirect_home", "res_users...`

I suggest reviewing and editing the tests as I tried to fix the issue in this PR #3038.

Unfortunately, this external module was not mentioned in the tests requirements: websocket-client

As a result the tests was not running, and after I installed websocket-client test failed.

`2024-12-25 07:26:39,542 54005 INFO web_responsive_9 odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot.TestUIPivot.test_ui: waiting for threads: []
2024-12-25 07:26:39,544 54005 INFO web_responsive_9 odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot: ======================================================================
2024-12-25 07:26:39,544 54005 ERROR web_responsive_9 odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot: FAIL: TestUIPivot.test_ui
Traceback (most recent call last):
File "/home/kobros/Workspace/odoo18/web/web_pivot_computed_measure/tests/test_ui_pivot.py", line 62, in test_ui
self.start_tour(
File "/home/kobros/Workspace/odoo18/odoo/odoo/tests/common.py", line 2076, in start_tour
return self.browser_js(url_path=url_path, code=code, ready=ready, timeout=timeout, success_signal="tour succeeded", **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kobros/Workspace/odoo18/odoo/odoo/tests/common.py", line 2052, in browser_js
self.fail('%s\n\n%s' % (message, error))
AssertionError: The test code "odoo.startTour('web_pivot_computed_measure_tour', {"stepDelay": 100, "keepWatchBrowser": false, "debug": false, "startUrl": "/odoo", "delayToCheckUndeterminisms": 0})" failed

UncaughtTypeError: Cannot read properties of undefined (reading '__computed_id')
at PivotModel.addComputedMeasure (http://127.0.0.1:8069/web/assets/06ae128/web.assets_backend_lazy.min.js:375:229)
at DropdownItemCustomMeasure.addMeasure (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:14672:150)
at Object.mainEventHandler (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:1603:77)
at HTMLButtonElement.listener (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:762:15)
at dispatch (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15204:71)
at triggerClick (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15132:94)
at _pointerUp (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15187:24)
at async _click (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15141:456)
at async Object.click (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15197:187)
at async TourHelpers.click (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:14733:72)
at addComputedMeasure (http://127.0.0.1:8069/web/assets/06ae128/web.assets_backend_lazy.min.js:374:228)
at addMeasure (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:14671:149)
at mainEventHandler (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:1602:76)
at listener (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:761:14)
at dispatch (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15203:70)
at triggerClick (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15131:93)
at _pointerUp (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15186:23)

`

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. install web_pivot_computed_measure without websocket-client and tests enabled
  2. install web_pivot_computed_measure with websocket-client and tests enabled

Expected behavior
In step 1 no eerors arises, just warnings, but in step 2 you get errors

@rvalyi
@zeroheure
@ovnicraft
@azmeuk
@pniederlag

Dominant language
JavaScript
Stars
1.2k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
30

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OCA/web

All issues in OCA/web

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.