Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Easy Connector with Odoo ERP!

This is a library that allow an easy and friendly connection with an Odoo ERP instance on Pyhton 3.x

Installation using PIP command

  • Use the command
$ pip install odoo_connector_2

How to use connect

from odoo.connectors import OdooConnector
odoo = OdooConnector(endpoint='your-odoo-endpoint', dbname='your-odoo-dbname', username='your-odoo-user', password='your-odoo-password')
uid = odoo.connect()

Hot to add, edit and delete ( using the method write() )

from odoo.connectors import OdooConnector
odoo = OdooConnector(endpoint='your-odoo-endpoint', dbname='your-odoo-dbname', username='your-odoo-user', password='your-odoo-password')
uid = odoo.connect()
# create a new partner
data = [{'name': 'Test User', 'email': 'test@domain.com'}]
result = odoo.write(uid=uid, model='res.partner', action='create', data=data)
# edit partner
id = 1 # change the value for the any do you want
data = [[id], {'name': 'Test User', 'email': 'test@domain.com'}]
result = odoo.write(uid=uid, model='res.partner', action='write', data=data)
# delete partner
id = 1 # change the value for the any do you want
data = [id]
result = odoo.write(uid=uid, model='res.partner', action='unlink', data=data)
# create a new user
data = [{'login': 'test@domain.com', 'name': 'Test User', 'password': '123456'}]
result = odoo.write(uid=uid, model='res.users', action='signup', data=data)

Hot to search, search_read and read ( using the method search() )

from odoo.connectors import OdooConnector
odoo = OdooConnector(endpoint='your-odoo-endpoint', dbname='your-odoo-dbname', username='your-odoo-user', password='your-odoo-password')
uid = odoo.connect()

query = [[['is_company', '=', True], ['customer', '=', True]]]
fields = ['name', 'email', 'country_id']

# using the search method
result = odoo.search(uid=uid, model='res.partner', action='search', queries=query, parameters=None)

# using the search with pagination
parameters = {'offset': 5, 'limit': 10}
result = odoo.search(uid=uid, model='res.partner', action='search', queries=query, parameters=parameters)

# using the search_count
odoo.search(uid=uid, model='res.partner', action='search_count', queries=query)

# using the read method
ids = odoo.search(uid=uid, model='res.partner', action='search', queries=query, parameters={'limit': 1})
if len(ids) > 0:
    result = self.odoo.search(
        uid=uid, model='res.partner', action='read', queries=ids, parameters={'fields': fields}  formatted=True)

# The "formatted" attribute allow format the result in a JSON object, this is a boolean attribute by default is False

# using the search_read method with parameters.
result = odoo.search(
            uid=uid, model='res.partner', action='search_read', queries=query, parameters={'fields': fields, 'limit': 2}, formatted=True)

The search and write methods were tested with all methods allowed on the External API Documentation from Odoo website and the write() and search() methods can work with any methods from any models existing on Odoo instance

To test any methods using unittest

  • Download or clone this repository
  • Edit the attributes from the DummieData class (find this class on tests/unittests.py)
  • run the follow command on the root directory.
$ python -m unittest -v tests/unittest.py

This is all, very very easy and friendly to work with Odoo from any Pyhton project using this library.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odoo_connector_2-1.0.1b3.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file odoo_connector_2-1.0.1b3.tar.gz.

File metadata

  • Download URL: odoo_connector_2-1.0.1b3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for odoo_connector_2-1.0.1b3.tar.gz
Algorithm Hash digest
SHA256 434d5f9322af0a607a5e408a81cd06b0235a14ddf2c65a164696932d1d2987cd
MD5 01ba259df47eef3c335fd34e10451ff5
BLAKE2b-256 33fd859ee017ed494519e876ceef81ea54a24876a3b72ebd05a40163ee820334

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.5

1 file

1.0.4

1 file

1.0.3

1 file

1.0.2

1 file

1.0.1

1 file

This release

1.0.1b3 This release

1 file

1.0.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page