The BFG10k for Odoo developers
All the power of Odoo json-rpc in a really easy way!
This web extension adds a terminal-like to control Odoo (11, 12, 13 & 14).
Downloads
When you visit a Odoo website, the browser action icon of the extension turn to enabled state. This indicates that the extension is ready to use in the current page.
Few commands aren't available on the frontend, use command 'help' to know the available commands.
You can toggle terminal using one of these options:
- Press CTRL + 1
- Use extension browser action icon
Description | Terminal Command |
---|---|
Create 'res.partner' record | create res.partner "{'name': 'The One'}" |
Search 'res.partner' records | search res.partner name,email "[['id', '>', 5]]" |
Search all fields of selected 'res.partner' records | search res.partner * "[['id', '>', 5]]" |
Read all fields of selected 'res.partner' record | read res.partner 5 * |
Read all fields of various 'res.partner' records | read res.partner 5,15,8 * |
View 'res.partner' records (only backend) | view res.partner |
View selected 'res.partner' record (only backend) | view res.partner 4 |
Install module | install mymodule |
Create alias | alias myalias print My name is $1 |
Notice the usage of quotes when use parameters with spaces.
Notice that a list is an string of values separated by commas. Example: "5, 15, 8"
- This extension have a "preferences" page where you can add commands to run on every session. This is useful for example to load a remote script to extend the 'terminal' features or declare custom aliases.
- This extension uses an internal context to extend the 'user context'. This 'terminal context' has by default the key 'active_test' = false (see issue #14 to get more information). This context only affects to terminal operations.
- The maximum buffered screen lines is set to 750. So, you can't see more than 749 records in the same query. This is necessary to avoid have a lot of nodes... One of the problems of use HTML elements to render the output :/
You can use "parameter generator" to create values.
Generator | Arguments | Default | Description |
---|---|---|---|
$STR | min,max | max = min | Generates a random string with a length between the given min and max |
$FLOAT | min,max | max = min | Generates a random float between the given min and max |
$INT | min,max | max = min | Generates a random int between the given min and max |
$INTSEQ | min,max | max = min | Generates a list of int's starting from min to max |
$INTITER | min,step | step = 1 | Generates a consecutive int starting from min (useful with 'repeat' command) |
$DATE | min,max | max = min | Generates a random date between the given min and max |
$TZDATE | min,max | max = min | Generates a random date between the given min and max (time zone format) |
$TIME | min,max | max = min | Generates a random time between the given min and max |
$TZTIME | min,max | max = min | Generates a random time between the given min and max (time zone format) |
$DATETIME | min,max | max = min | Generates a random date time between the given min and max |
$TZDATETIME | min,max | max = min | Generates a random date time between the given min and max (time zone format) |
min,max | max = min | Generates a random email | |
$URL | min,max | max = min | Generates a random url |
$NOWDATE | Gets the current date | ||
$TZNOWDATE | Gets the current date (time zone format) | ||
$NOWTIME | Gets the current time | ||
$TZNOWTIME | Gets the current time (time zone format) | ||
$NOW | Gets the current date time | ||
$TZNOW | Gets the current date time (time zone format) |
The anatomy of a generator is: $type[min,max]
, $type[max]
or $type
For example:
- create a new record with a random string:
create res.partner "{'name': '$STR[4,30]'}"
- print the current time:
print $NOWTIME
Notice that 'date' min and max are the milliseconds since 1970/01/01
You can define aliases to call commands with predefined values. This command can use positional replacements.
The anatomy of a positional replacement is: $num[default_value]
or $num
For example:
- First positional replacement (without default value = empty):
alias my_alias print Hello, $1
- Fist position replacement with default value 'world':
alias my_alias print Hello, $1[world]
- A somewhat more complex:
alias search_mod search ir.module.module display_name "[['name', '=', '$1'], ['state', '=', '$2[installed]']]"
You can execute "subcommands" to use the result in a new command call. The
syntax of runners looks like {{command}}
, {{command}}.key
or
{{command}}[index]
.
For example: read res.users {{search res.users id []}}.id
Massive operations are possible using the command repeat
. Print to screen is a
expensive task, consider use the command mute
to increase the performance.
Example: repeat 5000 mute create res.partner "{'name': '$STR[12] (Test)'}"
Permission | Reason |
---|---|
activeTab | Enables support to get information about browser tabs |
storage | Enables support to manage stored data in the browser (used for preferences) |
Copyright 2019-2021 Alexandre Díaz & contributors
AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
All content under 'icons/' has its own licenses and original authors.