%global _empty_manifest_terminate_build 0 Name: python-Flask-Odoo Version: 0.4.2 Release: 1 Summary: Flask-Odoo is an extension for Flask that aims to simplify the integration with the Odoo XML-RPC API License: MIT URL: https://github.com/teamgeek-io/flask-odoo Source0: https://mirrors.aliyun.com/pypi/web/packages/cd/69/edd2a650e0bfda3e80c8e25dd5e5c5ff0c464de831f400910663d7174af6/Flask-Odoo-0.4.2.tar.gz BuildArch: noarch Requires: python3-Flask Requires: python3-schematics %description # Flask-Odoo Flask-Odoo is an extension for [Flask](https://flask.palletsprojects.com/) that aims to simplify the integration with the [Odoo](https://www.odoo.com/) XML-RPC [External API](https://www.odoo.com/documentation/13.0/webservices/odoo.html). ## Installing Install and update using [pip](https://pip.pypa.io/en/stable/quickstart/): ``` $ 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]]) [] ``` 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](https://github.com/schematics/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. %package -n python3-Flask-Odoo Summary: Flask-Odoo is an extension for Flask that aims to simplify the integration with the Odoo XML-RPC API Provides: python-Flask-Odoo BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-Flask-Odoo # Flask-Odoo Flask-Odoo is an extension for [Flask](https://flask.palletsprojects.com/) that aims to simplify the integration with the [Odoo](https://www.odoo.com/) XML-RPC [External API](https://www.odoo.com/documentation/13.0/webservices/odoo.html). ## Installing Install and update using [pip](https://pip.pypa.io/en/stable/quickstart/): ``` $ 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]]) [] ``` 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](https://github.com/schematics/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. %package help Summary: Development documents and examples for Flask-Odoo Provides: python3-Flask-Odoo-doc %description help # Flask-Odoo Flask-Odoo is an extension for [Flask](https://flask.palletsprojects.com/) that aims to simplify the integration with the [Odoo](https://www.odoo.com/) XML-RPC [External API](https://www.odoo.com/documentation/13.0/webservices/odoo.html). ## Installing Install and update using [pip](https://pip.pypa.io/en/stable/quickstart/): ``` $ 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]]) [] ``` 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](https://github.com/schematics/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. %prep %autosetup -n Flask-Odoo-0.4.2 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-Flask-Odoo -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Jun 20 2023 Python_Bot - 0.4.2-1 - Package Spec generated