
- La validación de action_enter_results no estaba verificando el campo value_selection - Esto causaba falso positivo de 'parámetros sin resultados ingresados' - Agregar value_selection a la condición del filtro
68 lines
2.0 KiB
Python
68 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Script para debuggear el autocompletado de selection
|
|
"""
|
|
|
|
import odoo
|
|
import logging
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
def debug_selection_autocomplete(env):
|
|
"""Debug del autocompletado"""
|
|
|
|
print("=" * 80)
|
|
print("DEBUG DE AUTOCOMPLETADO DE SELECTION")
|
|
print("=" * 80)
|
|
|
|
# Buscar un resultado con tipo selection
|
|
result = env['lims.result'].search([
|
|
('parameter_value_type', '=', 'selection'),
|
|
('test_id.state', '=', 'in_process')
|
|
], limit=1)
|
|
|
|
if result:
|
|
print(f"\nResultado encontrado:")
|
|
print(f" - ID: {result.id}")
|
|
print(f" - Parámetro: {result.parameter_id.name}")
|
|
print(f" - Valor actual: '{result.value_selection}'")
|
|
print(f" - Valores posibles: {result.parameter_id.selection_values}")
|
|
|
|
# Probar el autocompletado
|
|
test_values = ['Negative', 'negative', 'NEG', 'neg', 'N', 'n', 'Positivo', 'P']
|
|
|
|
print("\nProbando autocompletado:")
|
|
for test_val in test_values:
|
|
autocompleted = result._validate_and_autocomplete_selection(test_val)
|
|
print(f" '{test_val}' -> '{autocompleted}'")
|
|
else:
|
|
print("No se encontraron resultados de tipo selection")
|
|
|
|
|
|
if __name__ == '__main__':
|
|
# Configuración
|
|
db_name = 'lims_demo'
|
|
|
|
# Conectar a Odoo
|
|
odoo.tools.config.parse_config(['--database', db_name])
|
|
|
|
# Obtener el registro de la base de datos
|
|
registry = odoo.registry(db_name)
|
|
|
|
# Crear cursor y environment
|
|
with registry.cursor() as cr:
|
|
env = odoo.api.Environment(cr, odoo.SUPERUSER_ID, {})
|
|
|
|
try:
|
|
# Debug
|
|
debug_selection_autocomplete(env)
|
|
|
|
# No guardar cambios
|
|
cr.rollback()
|
|
|
|
except Exception as e:
|
|
cr.rollback()
|
|
print(f"\n❌ Error: {str(e)}")
|
|
_logger.error(f"Error: {str(e)}", exc_info=True) |