Making RPC calls to the server
Sooner or later, your widget will need to look up some data from the server. In this recipe, we will add a category booked panel to the category information panel. When the user hovers their cursor over the category color pill element, the booked panel will show the number of booked rooms related to that category color. We will make an RPC call to the server to fetch a book count of the data associated with that particular category.
Getting ready
For this recipe, we will be using the my_hostel
module from the previous recipe.
How to do it…
Follow these steps to make an RPC call to the server and display the result in a colorPreviewPanel
:
- Import
@odoo/owl
and extract theonWillStart,onWillUpdateProps
reference to a variable, as shown in the following code:import { Component, onWillStart , onWillUpdateProps} from "@odoo/owl";
- Add the
onWillStart
method to thesetup
method and call our customload
ColorData
...