Webextension tool for Odoo
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 to 17). All implemented commands use the tools provided by the Odoo framework. An unwavering policy when developing this extension is to not modify or alter in any way the Odoo classes. This sometimes results in certain commands having reduced/increased capabilities depending on the Odoo version.
The terminal is fully initialized when it is first opened after loading the page. The time overhead for using this extension is ~24ms.
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:
Description | Terminal Command |
---|---|
Create 'res.partner' record | create -m res.partner -v {name: 'Hipcut', street: 'Mystery street'} |
Search 'res.partner' records | search -m res.partner -f name,email -d [['id', '>', 5]] |
Search all fields of selected 'res.partner' records | search -m res.partner -f * -d [['id', '>', 5]] |
Read all fields of selected 'res.partner' record | read -m res.partner -i 5 -f * |
Read all fields of various 'res.partner' records | read -m res.partner -i 5,15,8 -f * |
View 'res.partner' records (only backend) | view -m res.partner |
View selected 'res.partner' record (only backend) | view -m res.partner -i 4 |
Install module | install -m mymodule |
Create alias | alias -n myalias -c "print 'My name is: $1'" |
Notice that a list is an string of values separated by commas. Example: "5, 15, 8" (quotes included) or can use array notation [5, 15, 8]
Notice that can call commands without 'named arguments', for example:
create res.partner {name: 'Hipcut', street: 'Mystery street'}
. The rule is that 'unnamed arguments' fill values following the order of the command arguments definition. So mix 'unnamed' with 'named' arguments can be done as long as the order is maintained.
search
, read
and create
commands returns recordsets
. Can use them to
write values with commit
command.
Example:
$rs = $(search res.partner)
$rs[4]['name'] = 'The Name'
$rs[2]['name'] = 'Other Name'
commit $rs
$record = $(read res.partner 8)
$record['name'] = 'Willy Wonka'
$record['city'] = 'O Courel'
commit $record
$new_rec = $(create res.partner {name: 'The test'})
print $new_rec
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:
alias -n my_alias -c "print -m 'Hello, $1'"
alias -n my_alias -c "print -m 'Hello, $1[world]'"
alias -n search_mod -c "search -m ir.module.module -f display_name -d [[name, =, '$1'], [state, =, '$2[installed]']]"
You can execute "commands" to use the result in a new command call. The syntax
of 'nested calls' looks like $(command)
.
For example: read -m res.users -i $(search -m res.users -f id)[0]['id']
or
read -m res.users -i $(search -m res.users -f id)['ids']
Massive operations are possible using the command repeat
. Print to screen is a
expensive task, consider use the --silent
argument to increase the
performance.
Examples:
repeat -t 5000 -c "create -m res.partner -v {name: $(gen str 12 8) + ' (Test)'}" --silent
$orders = $(search sale.order); repeat -t $orders['length'] -c "call sale.order action_cancel [$orders[$repeat_index]['id']]"
Can use the command 'genfile' to create a file object that can be sent via post.
Example:
post /web/binary/upload_attachment -d {callback: '', model: 'res.partner', id: 1, ufile: $(genfile)}
Can open websocket connections (Odoo 16.0+).
Example:
$webs = $(ws -o open -e /websocket)
ws -o send -wo $webs -d "hello"
The way to do math operations is pretty similar to 'shell script' syntax:
$((<OPERATION>))
Examples:
print $((3*2))
$prod = $(read product.product 3 -f lst_price); $prod['lst_price'] = $((5*$prod['lst_price'])); commit $prod;
Permission | Description | Reason |
---|---|---|
activeTab | Enables support to get information about browser tabs | Used to detect Odoo pages |
storage | Enables support to manage stored data in the browser | Used for preferences |
Copyright Alexandre Díaz & contributors
AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)