#9 config(Tryton): read tryton params from environment.

This commit is contained in:
Mono Mono 2025-07-20 22:01:34 -05:00
parent 3d9feeac43
commit 3a5e13624f

View File

@ -12,6 +12,12 @@ from decimal import Decimal
from sabatron_tryton_rpc_client.client import Client
import io
import csv
import os
TRYTON_HOST = os.environ.get('TRYTON_HOST', 'localhost')
TRYTON_DATABASE = os.environ.get('TRYTON_DATABASE', 'tryton')
TRYTON_USERNAME = os.environ.get('TRYTON_USERNAME', 'admin')
TRYTON_PASSWORD = os.environ.get('TRYTON_PASSWORD', 'admin')
class Pagination(PageNumberPagination):
@ -170,10 +176,10 @@ class SalesForTrytonView(APIView):
class SalesToTrytonView(APIView):
def post(self, request):
tryton_client = Client(
hostname='localhost',
database='tryton',
username='admin',
password='admin'
hostname=TRYTON_HOST,
database=TRYTON_DATABASE,
username=TRYTON_USERNAME,
password=TRYTON_PASSWORD
)
tryton_client.connect()
method = 'model.sale.sale.create'