#9 config(Tryton): read tryton params from environment.
This commit is contained in:
parent
3d9feeac43
commit
3a5e13624f
@ -12,6 +12,12 @@ from decimal import Decimal
|
|||||||
from sabatron_tryton_rpc_client.client import Client
|
from sabatron_tryton_rpc_client.client import Client
|
||||||
import io
|
import io
|
||||||
import csv
|
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):
|
class Pagination(PageNumberPagination):
|
||||||
@ -170,10 +176,10 @@ class SalesForTrytonView(APIView):
|
|||||||
class SalesToTrytonView(APIView):
|
class SalesToTrytonView(APIView):
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
tryton_client = Client(
|
tryton_client = Client(
|
||||||
hostname='localhost',
|
hostname=TRYTON_HOST,
|
||||||
database='tryton',
|
database=TRYTON_DATABASE,
|
||||||
username='admin',
|
username=TRYTON_USERNAME,
|
||||||
password='admin'
|
password=TRYTON_PASSWORD
|
||||||
)
|
)
|
||||||
tryton_client.connect()
|
tryton_client.connect()
|
||||||
method = 'model.sale.sale.create'
|
method = 'model.sale.sale.create'
|
||||||
|
Loading…
Reference in New Issue
Block a user