Skip to main content

Flask-Odoo

Flask-Odoo is an extension for Flask that aims to simplify the integration with the Odoo XML-RPC External API.

Installing

Install and update using pip:

$ pip install -U Flask-Odoo

Example

Initialize the Flask extension:

from flask import Flask
from flask_odoo import Odoo

app = Flask(__name__)
app.config["ODOO_URL"] = "http://localhost:8069"
app.config["ODOO_DB"] = "odoo"
app.config["ODOO_USERNAME"] = "admin"
app.config["ODOO_PASSWORD"] = "admin"
odoo = Odoo(app)

if you are using a Mac you may need to set unverified ssl context

app.config["USE_UNVERIFIED_SSL_CONTEXT"] = "True"

then fetch the Odoo version information by:

>>> odoo.common.version()
{
    "server_version": "13.0",
    "server_version_info": [13, 0, 0, "final", 0],
    "server_serie": "13.0",
    "protocol_version": 1,
}

or call a method on an Odoo model:

>>> odoo["res.partner"].check_access_rights("read", raise_exception=False)
true

If you prefer to use a higher level interface you can declare models by extending odoo.Model as follows:

class Partner(odoo.Model):
    _name = "res.partner"
    _domain = [["active", "=", True]]

    name = odoo.StringType()

count the number of records:

>>> Partner.search_count([["is_company", "=", True]])
1

search and read records:

>>> Partner.search_read([["is_company", "=", True]])
[<Partner(id=1)>]

read records by id:

>>> partner = Partner.search_by_id(1)
>>> partner.name
'Odoo'

create and update records:

>>> new_partner = Partner()
>>> new_partner.name = "Teamgeek"
>>> new_partner.id is None
True
>>> new_partner.create_or_update()
>>> new_partner.id
2

delete records:

>>> existing_partner = Partner()
>>> existing_partner.id = 2
>>> existing_partner.delete()

The odoo.Model base extends the Schematics Model class, which means that your models inherit all the capabilities of a Schematics model. For convenience the basic Schematics types are accessible directly from the Odoo instance. These types also handle Odoo False values for non-boolean types.

Contributing

Setup your development environment by running:

$ make

this will create a new Python virtualenv, install all necessary dependencies and run the tests.

Metadata

Release files for Flask-Odoo 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Odoo 0.4.2
File Size Uploaded Provenance Actions
Flask-Odoo-0.4.2.tar.gz 6.2 kB Without provenance Details for Flask-Odoo-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Flask-Odoo 0.4.2
File Interpreter ABI Platform Actions
Flask_Odoo-0.4.2-py3-none-any.whl Python 3 none any Details for Flask_Odoo-0.4.2-py3-none-any.whl

Total release size: 12.9 kB

Release files / Flask-Odoo-0.4.2.tar.gz

Download URL Flask-Odoo-0.4.2.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
38a0d3ca254677c1b7905c779c47185e2bc1cbb75dc570bb7e069f1e8c049b78
BLAKE2b-256 checksum
How to use checksums
cd69edd2a650e0bfda3e80c8e25dd5e5c5ff0c464de831f400910663d7174af6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.6

Release files / Flask_Odoo-0.4.2-py3-none-any.whl

Download URL Flask_Odoo-0.4.2-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a881e5f22dc52c73c68088c64ccd12642723831f790890e801a207045c628bf2
BLAKE2b-256 checksum
How to use checksums
797b9ae09e072de52b4a33fe5582c159b50f867a31fc447352c202cf53d9f429
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.6

Security for Flask-Odoo 0.4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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