Skip to content

Commit

Permalink
Add partial inventory
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Bisserié <[email protected]>
  • Loading branch information
vbisserie committed Oct 29, 2023
1 parent 5838667 commit d45cd91
Show file tree
Hide file tree
Showing 6 changed files with 4,934 additions and 4,725 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM node:14-slim AS frontend
COPY ./client /app/client
RUN cd /app/client; \
npm install; \
RUN cd /app/client &&\
npm install --no-optional &&\
npm run build

FROM python:3.8-slim
Expand Down
16 changes: 14 additions & 2 deletions api/odoo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import logging
import os
import ssl
import xmlrpc.client

NO_SSL = os.environ.get("NO_SSL", "False").lower() in ["true", "1"]
NO_ODOO = os.environ.get("NO_ODOO", "False").lower() in ["true", "1"]
FAKE_PRODUCT_NB = 100

ODOO_URL = os.getenv("ODOO_URL", "https://sas.lachouettecoop.fr")
ODOO_DB = os.getenv("ODOO_DB", "dbsas")
ODOO_LOGIN = os.getenv("ODOO_LOGIN")
Expand All @@ -13,9 +18,16 @@ def __init__(self):
try:
common_proxy_url = "{}/xmlrpc/2/common".format(ODOO_URL)
object_proxy_url = "{}/xmlrpc/2/object".format(ODOO_URL)
self.common = xmlrpc.client.ServerProxy(common_proxy_url)
context = ssl._create_unverified_context() if NO_SSL else None
self.common = xmlrpc.client.ServerProxy(
common_proxy_url,
context=context,
)
self.uid = self.common.authenticate(ODOO_DB, ODOO_LOGIN, ODOO_PASSWORD, {})
self.models = xmlrpc.client.ServerProxy(object_proxy_url)
self.models = xmlrpc.client.ServerProxy(
object_proxy_url,
context=context,
)
except Exception as e:
logging.error(f"Odoo API connection impossible: {e}")

Expand Down
Loading

0 comments on commit d45cd91

Please sign in to comment.