odoo/documentation#13234

Created by fw-bot
Error: ci/runbot on 3ff98c0bd2e3958513a88b9a7005b0f530aa0117 (view more at https://runbot.odoo.com/runbot/build/79904648)
label
odoo-dev:saas-18.3-18.0-434095-fw
head
d59163f14f694c9165788cbc94ea1760b8437735
odoo/documentation
18.0 #13151
saas-18.1 #13232
saas-18.2 #13233
saas-18.3 #13234
master #13235

[FW][FIX] rpc: fix code examples for tutorial and service

I am a newbie from April and was following the "Discover the web framework" guide (https://www.odoo.com/documentation/18.0/developer/tutorials/discover_js_framework/02_build_a_dashboard.html#call-the-server-add-some-statistics) and saw that the link and example provided were outdated.

For example, it was like this:

setup() {
      this.rpc = useService("rpc");
      onWillStart(async () => {
         const result = await this.rpc("/my/controller", {a: 1, b: 2});
         // ...
      });
}

Which is now

import { rpc } from "@web/core/network/rpc";
// ... 

setup() {
      onWillStart(async () => {
            const syncResult = await rpc("/my/controller", {a: 1, b: 2});
      })
      // ...
}

I also changed the code example inside the Reference for the RPC service as it was also out of date. There might be a need to move this to another category as it might not be a Service anymore, I wasn't able to determine is it would be best or not (or which one would be best).

Forward-Port-Of: #13151