odoo/odoo#159348

Created by JavaScript, Aaron Bohy (aab)
Closed
label
odoo-dev:saas-17.2-hoot-fixes-aab
head
6024951ee69851f83c9e964f130e803d083c4d03
target
saas-17.2

[FIX] web: tests: fix issues in mock_model and mock_server

This commit fixes two issues.

The first one was in the mocked Model, in _unityReadRecords. When reading reference fields, we must read a related record, whose model and id are encoding in the value of the reference fields. Before this commit, we read the record on the wrong model (the main one, not the one of the reference field).

The second issue was in the MockServer. Commit [1] recently introduced the function stepAllNetworkCalls to call expect.step() for each server method/route called during the test. However, this didn't work properly for the route /web/dataset/call_kw/<path>. First because of a small mistake ("===" instead of "startswith" to match the route). Second because we didn't call the regular mock function for those routes, leading to crashes as the server always returned undefined.

[1] e721f1c7ce923b8f74abc3fef57ee5e9dd4c43ed

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:




---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr