erppeek icon indicating copy to clipboard operation
erppeek copied to clipboard

Allow scripting

Open omacchioni opened this issue 7 years ago • 1 comments

Use case: run non-interactively a bunch of commands against Odoo...

This would allow things like:

#!bin/erppeek

users = model('res.users').browse()
for user in users:
  print user.login

omacchioni avatar Oct 09 '18 09:10 omacchioni

You can achieve it with a minimum of boilerplate in your script, to load the configuration and build the Client instance.

It assumes that you have an erppeek.ini file in your current directory with a section [demo]

#! /usr/bin/env python
import erppeek

client = erppeek.Client.from_config('demo')
model = client.model

users = model('res.users').browse()
for user in users:
    print(user.login)

florentx avatar Nov 22 '18 09:11 florentx