Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow scripting #103

Open
omacchioni opened this issue Oct 9, 2018 · 1 comment
Open

Allow scripting #103

omacchioni opened this issue Oct 9, 2018 · 1 comment
Labels

Comments

@omacchioni
Copy link
Contributor

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
@florentx
Copy link
Member

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants