The shell command

Python has a command-line interface that is a great way to explore its syntax. Similarly, Odoo also has an equivalent feature, where we can interactively try out commands to see how they work. That is the shell command.

To use it, run Odoo with the shell command and the database to be used, as shown here:

$ ./odoo-bin shell -d todo

You should see the usual server start up sequence in the terminal until it stops on a >>> Python prompt waiting for your input. Here, self will represent the record for the Administrator user, as you can confirm by typing the following:

>>> self
res.users(1,)
>>> self._name
'res.users'
>>> self.name
'Administrator'

In the shell session here, we inspected our environment. The self represents a ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.