summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/rpc.js
AgeCommit message (Collapse)Author
2020-06-15[REF] mail, *: refactor messaging with OWLSébastien Theys
This commit is a significant rewriting of client-side discuss, chatter, chat window, and messaging menu using OWL. The behavior should be broadly the same, with some slight functional changes here and there. From a technical standpoint, the code of messaging is mainly organized in 2 main groups of modules: - models, which are logical entities that depict the client-side state of messaging as a whole. - components, which are in charge of displaying information from models. This refactoring also introduces new JS guidelines regarding folder structure (/static) and naming rules for JS modules. Community PR: https://github.com/odoo/odoo/pull/39023 Enterprise PR: https://github.com/odoo/enterprise/pull/6249 Task-1914207 This PR is a collaborative work by Alexandre, Julien, Sébastien and Xavier, with the precious help of Lucas to speed it up towards the end. closes odoo/odoo#39023 Related: odoo/enterprise#6249 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Co-authored-by: Alexandre Kühn <aku@odoo.com> Co-authored-by: Julien Giannone <jgi@odoo.com> Co-authored-by: Lucas Perais <lpe@odoo.com> Co-authored-by: Sébastien Theys <seb@odoo.com> Co-authored-by: Xavier Dubuc <xdu@odoo.com>
2019-04-02[IMP] web: fetch records alongside read_groupAaron Bohy
This rev. adds params to the 'web_read_group' method, allowing to search_read records inside each groups in a single RPC, instead of doing a 'web_read_group' RPC followed by n 'search_read' RPCs, where n is the number of opened groups. Part of task 1915702
2019-04-02[IMP] web,board: enable pagination in grouped listsAaron Bohy
With this rev., when there are a lot of groups in a grouped list view, groups are displayed under several pages, whereas they were all displayed in the same page before. This is especially interesting with the new 'expand' attribute, to ensure that we don't read records for a large number of groups. By default, the groups limit is set to 80 (like records), and to 10 is the 'expand' attribute is set to true. This limit can be overriden with the 'groups_limit' attribute. Part of task 1915702
2019-03-06[REF] web: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2018-04-03[FIX] web,account,google_calendar: chasing breaking spacesRémi Rahir
Before this commit, some breaking spaces were present in the js code. Such spaces are misinterpreted and worked by luck. This has become a problem with exported js bunldes (e.g. the external_lib bundle in im_livechat). This commit replaces breaking spaces by regular spaces.
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[FIX] web: properly transfer lazy=false option to rpcGéry Debongnie
The lazy option in read_group is by default true, so when we want to override it with false, it needs some special care.
2017-04-11[REF] web, *: simplify our RPC system (in JS)Géry Debongnie
The RPC system was not completely satisfactory, we decided to prepare the future and do it properly. This commit introduces the new rpc system, which replace the previous new one. We now simply have a method, this._rpc, which takes a dictionary of parameters. The idea is that depending on the parameters, it is able to add correct default value when necessary. For situations where we don't have the this._rpc method, we can use the rpc.query method, which takes the same arguments, but directly calls ajax.rpc instead of triggering up some events.
2017-04-11[IMP] web: rpc: more permissive API for read_groupAaron Bohy
This rev. allows to specify some kwargs of read_group directly in an Object given to kwargs(), instead of explicitly specify them using the corresponding method (e.g. to specify the context in the kwargs instead of by calling .withContext().
2017-04-11[FIX] web: rpc: call route: don't override given paramsAaron Bohy
When calling a route using the new RPC query builder (e.g. by doing "this._rpc('/a/route').params({a: 'a'}).exec()"), if one of the route kwargs was 'model', 'method', 'args' or 'kwargs', the given value was overriden by undefined.
2017-04-11[FIX] web: rpc: handle offset argAaron Bohy
Even if specified when building the rpc query, the offset wasn't given in the arguments of the performed RPC.
2017-04-11[IMP] web: remove perform(Model)RPCGéry Debongnie
and replace them with a new, private, _rpc method. Also, extends the rpc builder to be able to send arbitrary parameters.
2017-04-11[ADD] web: introduce new RPC frameworkGéry Debongnie
With this commit, we introduce a new way to perform a RPC. During the history of the Odoo web client, many ways to do a rpc have been introduced, for various reasons. Let us mention the Model class (to perform a call on a specific method from a model, the web.ajax module (low level primitive), the dataset.call method, the this.rpc method (was removed at some point), the session.rpc method and maybe some others. With this commit, we reintroduce the this.rpc method, with a 'mid-level' API: not really high level (not automatic domain/context calculations), but still higher level than direct web.ajax calls. This new method is intended to replace all other RPCs in Odoo web client. Of course, web.ajax will still be available, but it is discouraged to use it directly. Using the rpc method means that the rpcs are done through an event bubbling up, which means that the call is testable.