Skip to content

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

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

leclerc-leo
Copy link
Contributor

@leclerc-leo leclerc-leo commented Apr 30, 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).

@robodoo
Copy link
Collaborator

robodoo commented Apr 30, 2025

Pull request status dashboard

@leclerc-leo leclerc-leo requested a review from AntoineVDV April 30, 2025 15:25
@C3POdoo C3POdoo requested a review from a team April 30, 2025 15:27
@leclerc-leo leclerc-leo force-pushed the 18.0 branch 2 times, most recently from e8ead2c to a74e82c Compare April 30, 2025 16:01
Copy link
Collaborator

@AntoineVDV AntoineVDV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robodoo delegate=aab-odoo delegate=fdardenne

Copy link
Contributor

@fdardenne fdardenne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this update. It's still not perfect indeed since it's not a service anymore but let's merge it and improve it incrementally.
@robodoo r+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants