- 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
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
import xmlrpc.client
|
|
import sys
|
|
import logging
|
|
|
|
ODOO_URL = 'http://localhost:16001'
|
|
ODOO_DB = 'hazard_new'
|
|
ODOO_USER = 'admin'
|
|
ODOO_PASS = 'admin'
|
|
|
|
def main():
|
|
common = xmlrpc.client.ServerProxy(f'{ODOO_URL}/xmlrpc/2/common')
|
|
uid = common.authenticate(ODOO_DB, ODOO_USER, ODOO_PASS, {})
|
|
if not uid:
|
|
print("No se pudo autenticar")
|
|
return
|
|
models = xmlrpc.client.ServerProxy(f'{ODOO_URL}/xmlrpc/2/object')
|
|
|
|
print("Consultando productos en Odoo...")
|
|
products = models.execute_kw(ODOO_DB, uid, ODOO_PASS,
|
|
'product.product', 'search_read',
|
|
[[('barcode', '!=', False)]],
|
|
{'fields': ['display_name', 'default_code', 'barcode']}
|
|
)
|
|
|
|
wrong_barcodes = []
|
|
for p in products:
|
|
if not p['barcode'].startswith('200001'):
|
|
wrong_barcodes.append(p)
|
|
|
|
print(f"\nSe encontraron {len(wrong_barcodes)} productos con un código de barras que NO empieza con 200001:\n")
|
|
for p in wrong_barcodes:
|
|
print(f"Producto: {p['display_name']}")
|
|
print(f"SKU: {p['default_code']}")
|
|
print(f"Barcode: {p['barcode']}")
|
|
print("-" * 40)
|
|
|
|
if __name__ == '__main__':
|
|
main()
|