summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/core/rpc_tests.js
AgeCommit message (Collapse)Author
2017-11-24[FIX] web: read_group RPCNicolas Martinelli
Example of failing request: ``` rpc.query({ model: 'link.tracker.click', method: 'read_group', args: [[links_domain, ['create_date', '>', interval]], ['country_id']], kwargs: {groupby:'country_id'}, }); ``` The RPC request built contains the following: ``` args: [[["link_id", "=", 1]], ["create_date"]] kwargs: {groupby: "create_date:day", domain: [], fields: []} ``` This will be interpreted server side as: ``` model.read_group([['link_id', '=', 1]], ['create_date'], groupby=['create_date:day'], domain=[], fields=[]) ``` 2 arguments match `domain` and `fields`, which causes a crash. opw-781300
2017-05-02[FIX] web: keep positional args for search_readDavid Monjoie
The previous code used to create its own args array for the search_read method, replacing the one that was originally given to it. This lead to silent errors since positional arguments to this function were completely ignored in the case of search_read. I took this commit as an opportunity to improve a bit on the current state of these rpc helpers. Namely, the basic args/kwargs priority is the following (top-to-bottom): - kwargs defined in the rpc call - kwargs defined in the kwargs key of the params kwarg of the rpc call - positional arguments are passed as is For read_group and search_read methods, the priority is the following: - kwargs defined in the rpc call - kwargs defined in the params kwarg to the rpc call - kwargs defined in the kwargs key of the params kwarg of the rpc call - positional arguments are passed as is For the /web/dataset/search_read controller, only the params kwarg is supported, resulting in the following priority: - kwargs defined in the rpc call - kwargs defined in the params kwarg to the rpc call - positional arguments are passed as is If both a kwargs and a positional arg is given for the same parameter, it will be sent as is to the server which will crash with a typical "got multiple values for keyword argument" TypeError. However, in the MockServer however, we give priority to kwargs over args in this case. Please note that I also chose to remove unnecessary default values so that the ones actually used are the ones from the server, not the ones that were duplicating those in the rpc js file.
2017-04-11[REF] account, web, web_diagram: rename static test folderGéry Debongnie
For consistency, every static test folder should be named 'tests', with a s.