46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
from proteus import config, Model
|
|
|
|
# XML-RPC Configuration
|
|
HTTPS = 'https://'
|
|
SERVER_URL = 'itsa.open-squared.tech'
|
|
DATABASE_NAME = 'tradon'
|
|
USERNAME = 'admin'
|
|
PASSWORD = 'dsproject'
|
|
|
|
# Connect via XML-RPC
|
|
try:
|
|
config.set_xmlrpc(f'{HTTPS}{USERNAME}:{PASSWORD}@{SERVER_URL}/{DATABASE_NAME}/')
|
|
|
|
print(f"Connected to Tryton database '{DATABASE_NAME}' successfully!")
|
|
|
|
# Get the model using Model.get()
|
|
Purchase = Model.get('purchase.purchase') # Using a common model to inspect fields, can be changed to 'purchase.purchase' if available
|
|
|
|
try:
|
|
# Try to get any existing record or create new (without saving)
|
|
purchases = Purchase.find([], limit=1)
|
|
if purchases:
|
|
sample = purchases[0]
|
|
else:
|
|
sample = Purchase()
|
|
|
|
# Get field names from the instance
|
|
field_names = sorted([key for key in dir(sample)
|
|
if not key.startswith('_')
|
|
and key not in ['create', 'delete', 'save', 'find']])
|
|
|
|
print(f"\nTotal fields in analytic.dimension: {len(field_names)}")
|
|
print("\nField list:")
|
|
for field in field_names:
|
|
print(f"{field}")
|
|
|
|
except Exception as e:
|
|
print(f"Could not inspect fields via instance: {e}")
|
|
|
|
|
|
except Exception as e:
|
|
print(f"Connection or operation failed: {e}")
|
|
print("\nPlease verify:")
|
|
print(f" - Tryton server is running on {SERVER_URL}")
|
|
print(f" - Database '{DATABASE_NAME}' exists")
|
|
print(f" - Username and password are correct") |