summaryrefslogtreecommitdiff
path: root/odoo/addons/base/controllers/rpc.py
AgeCommit message (Collapse)Author
2020-04-09[FIX] core: calling read_group / name_search over xmlrpcXavier Morel
Also non-browser jsonrpc (as it goes through a similar process): for internal performance reasons, name_search and read_group have been converted to a *lazy* name_get, so the "display name" is not unnecessarily computed. However this is an issue for the RPC endpoints (/xmlrpc and /jsonrpc) as they have no support for `lazy` and thus tend to blow up and / or do the wrong thing when trying to output a lazy: * xmlrpc has no way to handle lazy at all and straight blows up * jsonrpc falls back to `json_default` so they try to stringify the lazy, which might have worked except *Problematically* both endpoints delegate the actual work to `dispatch_rpc` which handles dispatching between various services and ultimately creates a *new* cursor before calling model methods (`object` service and `execute`/`execute_kw`). This means by the time the result is serialized to be output, the lazy's cursor has long been closed, and thus any access to an unevaluated `lazy` errors out when trying to fetch the underlying item. This also means we can't just add a hook to serialize the lazy in the xmlrpc marshaller, though we do have to do that. We *also* (for both xmlrpc and jsonrpc) have to force evluation of lazy values before our cursor is closed, meaning it has to be done right after the method is invoked, iterating the entire response. Related to task 2170343 closes odoo/odoo#49286 X-original-commit: e2b5a359c1d5eccbe725c1c3169b4130d7bca49b Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-10-03[FIX] base: XML-RPC controller methodsNaglis Jonaitis
`method` has no effect, so currently XML-RPC can be called via other methods, e.g. GET, which is against XML-RPC specification. closes odoo/odoo#37917 X-original-commit: c2fe13d31f6b55900ad139d4e75b8c1a0c4ac165 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2018-10-22[FIX] xmlrpc: properly marshall date & datetime objectsAdrian Torres
Before this revision, trying to read a Date field using xmlrpc would result in a marshalling error. This is due to the fact that 960360afe478a8f7b9c456721b5591154952a37d changed the internal value of Date/Datetime fields to hold datetime.date/datetime objects. The xmlrpc layer is capable of converting datetimes to the XML datetime representation, but this is not possible for datetime.date objects. In order to solve this, the Marshaller class used by python's xmlrpc.client is overridden and monkey-patched, allowing to convert datetime.date / datetime.datetime objects into properly formatted strings. opw-1896364 closes odoo/odoo#28022
2018-05-28[IMP] http: avoid saving sessions for some endpointsChristophe Simonis
Endpoints can be explicitly marked as `save_session=False` (default is true across the board). In that case they will have an in-memory session (either the existing one or a brand new one) but the session won't be persisted to disk. Currently used for non-browser RPC endpoints: the APIs don't use cookies/sessions and we can't assume the RPC libraries keep cookies across calls. This means a new session is created and saved to disk for each RPC calls, for no useful reason.
2018-05-09[IMP] Handle XMLRPC calls from standard controllersJairo Llopis
This way, XMLRPC calls can get request details form the standard `odoo.http.request` system. Move jsonrpc to the same controller while at it, for coherence. Fix #24183