Using the Odoo shell to interactively call methods
The Odoo web interface is meant for end users, although the developer mode unlocks a number of powerful features. However, testing and debugging through the web interface is not the easiest way to do things, as you need to manually prepare data, navigate in the menus to perform actions, and so on. The Odoo shell is a command-line interface, which you can use to issue calls. This recipe shows how to start the Odoo shell and perform actions such as calling a method inside the shell.
Getting ready
We will reuse the same code as in the previous recipe to produce server logs to help debug methods; this enables the product.product
model to add a new method. We assume that you have an instance with the addon installed available. In the recipe, we expect that you have an Odoo configuration file for this instance called project.conf
.
How to do it…
In order to call the export_stock_level()
method from the Odoo shell, you need to perform the following...