How it works...

execute_kw is capable of calling any public method of the model. As we saw in the Calling methods through XML-RPC recipe, public methods are those whose name is not stated with _ (underscore). Methods that start with _ are private and you cannot invoke them from the JSON-RPC.

In our example, we created a book with the state draft. Then we made one more RPC call to invoke the make_available method, which will change the book state to available. Finally, we made one more RPC call to check the state of the book. This will show that the book's state is changed to available.

Note that methods that do not return anything internally return None by default. Such methods cannot be used by RPC. If you want to use your method from RPC, at least add the return True statement.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset