Files
hazard_odoo/query_odoo.py
T
tess_admin 28d9e56f47 🎉 Initial commit - Hazard Odoo 16 project
- Custom modules: hazard_shopify, hazard_inventory_report, hazard_website
- Third-party modules: bi_sql_editor, query_deluxe, sql_request_abstract, l10n_mx_sat_sync_itadmin_ee
- Docker setup: Odoo 16 + PostgreSQL 17
- Utility scripts: backup_hazard.sh, update_module.py
- Agent configuration: .agents/AGENTS.md
- Security: Enterprise modules, credentials, backups and production data excluded via .gitignore
2026-06-30 06:12:35 -06:00

35 lines
1.3 KiB
Python

import xmlrpc.client
url = 'http://localhost:16001'
db = 'hazard_new'
username = 'admin'
password = '123'
# Try 123, then admin, then check
try:
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
uid = common.authenticate(db, username, 'admin', {})
if not uid:
uid = common.authenticate(db, 'admin', '123', {})
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))
# Get sale order S00693
sale_orders = models.execute_kw(db, uid, 'admin', 'sale.order', 'search_read', [[['name', '=', 'S00693']]], {'fields': ['id', 'name', 'shopify_fulfillment_status', 'state', 'message_ids']})
print("Sale Order:", sale_orders)
# Get pickings for S00693
if sale_orders:
pickings = models.execute_kw(db, uid, 'admin', 'stock.picking', 'search_read', [[['origin', '=', 'S00693']]], {'fields': ['id', 'name', 'state', 'message_ids']})
print("Pickings:", pickings)
# get messages
msg_ids = pickings[0]['message_ids']
if msg_ids:
msgs = models.execute_kw(db, uid, 'admin', 'mail.message', 'read', [msg_ids], {'fields': ['body']})
for m in msgs:
print("Picking MSG:", m['body'])
except Exception as e:
print("Error:", e)