Django Odoo Auth (Odoo backend with django)
Django app for Odoo (formerly OpenERP) authentication.
Application development and testing with django v1.6.5
Contents
Add
odoo_auth
to your INSTALLED_APPS setting like this:INSTALLED_APPS = ( ... 'odoo_auth', )
Add
backend
to your AUTHENTICATION_BACKENDS setting like this:AUTHENTICATION_BACKENDS = ( ... 'odoo_auth.backends.OdooBackend', )
Edit the information to connect to your server Odoo in
odoo_auth/settings.py
ODOO_SERVER_URL = getattr(settings, 'ODOO_SERVER_URL', 'http://localhost') ODOO_SERVER_PORT = getattr(settings, 'ODOO_SERVER_PORT', 8069) ODOO_SERVER_DBNAME = getattr(settings, 'ODOO_SERVER_DBNAME', 'demo')
Run
python manage.py syncdb
to create the odoo_auth models.For call
odoo_auth
, use standard authenticatefrom django.contrib.auth import authenticate user = authenticate(username=username, password=password)
Access in template to
odoo_auth
{{ user.odoouser.odoo_id }} {{ user.odoouser.username }}