Files
Wiki/Odoo Shell Scripts.md

2.2 KiB

Odoo Shell

Basics

List all fields

record = env['res.config.settings'].browse(1)
for field in record.fields_get():
    print(field)

List all products

	for product in env['product.template'].search([]):
		print(product.name)

Execute sql quer.

self._cr.execute("SELECT * FROM account_move WHERE id = 16")

Generate password.

from passlib.context import CryptContext
setpw = CryptContext(schemes=['pbkdf2_sha512'])
setpw.encrypt('YourNewPassword')

Commands

Log into Docker Container.

CONTAINER=odoo04
docker exec -it $CONTAINER bin/bash

Start Odoo Shell.

DATABASE=odoo14
odoo shell -d $DATABASE --db_host $HOST -r $USER -w $PASSWORD
<