Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

fw-bot
Copy link
Collaborator

@fw-bot fw-bot commented May 7, 2025

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

@robodoo
Copy link
Collaborator

robodoo commented May 7, 2025

Pull request status dashboard

@fw-bot
Copy link
Collaborator Author

fw-bot commented May 7, 2025

@fdardenne
Copy link
Contributor

@robodoo r+

robodoo pushed a commit that referenced this pull request May 8, 2025
closes #13235

X-original-commit: 2712116
Signed-off-by: Florent Dardenne (dafl) <dafl@odoo.com>
robodoo pushed a commit that referenced this pull request May 9, 2025
closes #13235

X-original-commit: 2712116
Signed-off-by: Florent Dardenne (dafl) <dafl@odoo.com>
robodoo pushed a commit that referenced this pull request May 9, 2025
closes #13235

X-original-commit: 2712116
Signed-off-by: Florent Dardenne (dafl) <dafl@odoo.com>
@robodoo robodoo closed this May 9, 2025
@robodoo robodoo added the 18.4 label May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants