[FIX] doc: report with xmlrpc

The feature was removed in commit 3425752eac.

Closes #22540
opw-1824272
This commit is contained in:
Nicolas Martinelli
2018-03-30 09:58:19 +02:00
committed by Nicolas Martinelli
parent f2c3561334
commit 694f2d4b20
-84
View File
@@ -1295,90 +1295,6 @@ activated as actual fields on the model.
}
]
Report printing
---------------
Available reports can be listed by searching the ``ir.actions.report``
model, fields of interest being
``model``
the model on which the report applies, can be used to look for available
reports on a specific model
``name``
human-readable report name
``report_name``
the technical name of the report, used to print it
Reports can be printed over RPC with the following information:
* the name of the report (``report_name``)
* the ids of the records to include in the report
.. container:: doc-aside
.. switcher::
.. code-block:: python
invoice_ids = models.execute_kw(
db, uid, password, 'account.invoice', 'search',
[[('type', '=', 'out_invoice'), ('state', '=', 'open')]])
report = xmlrpclib.ServerProxy('{}/xmlrpc/2/report'.format(url))
result = report.render_report(
db, uid, password, 'account.report_invoice', invoice_ids)
report_data = result['result'].decode('base64')
.. code-block:: php
$invoice_ids = $models->execute_kw(
$db, $uid, $password,
'account.invoice', 'search',
array(array(array('type', '=', 'out_invoice'),
array('state', '=', 'open'))));
$report = ripcord::client("$url/xmlrpc/2/report");
$result = $report->render_report(
$db, $uid, $password,
'account.report_invoice', $invoice_ids);
$report_data = base64_decode($result['result']);
.. code-block:: ruby
require 'base64'
invoice_ids = models.execute_kw(
db, uid, password,
'account.invoice', 'search',
[[['type', '=', 'out_invoice'], ['state', '=', 'open']]])
report = XMLRPC::Client.new2("#{url}/xmlrpc/2/report").proxy
result = report.render_report(
db, uid, password,
'account.report_invoice', invoice_ids)
report_data = Base64.decode64(result['result'])
.. code-block:: java
final Object[] invoice_ids = (Object[])models.execute(
"execute_kw", asList(
db, uid, password,
"account.invoice", "search",
asList(asList(
asList("type", "=", "out_invoice"),
asList("state", "=", "open")))
));
final XmlRpcClientConfigImpl report_config = new XmlRpcClientConfigImpl();
report_config.setServerURL(
new URL(String.format("%s/xmlrpc/2/report", url)));
final Map<String, Object> result = (Map<String, Object>)client.execute(
report_config, "render_report", asList(
db, uid, password,
"account.report_invoice",
invoice_ids));
final byte[] report_data = DatatypeConverter.parseBase64Binary(
(String)result.get("result"));
.. note::
the report is sent as PDF binary data encoded in base64_, it must be
decoded and may need to be saved to disk before use
.. _PostgreSQL: http://www.postgresql.org
.. _XML-RPC: http://en.wikipedia.org/wiki/XML-RPC