fix(#67): Incluir value_selection en validación de resultados ingresados
- 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
This commit is contained in:
parent
f8be847777
commit
34f3b0aa14
BIN
documents/logs/Screenshot_8.png
Normal file
BIN
documents/logs/Screenshot_8.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
|
@ -284,7 +284,7 @@ class LimsTest(models.Model):
|
|||
|
||||
# Verificar que todos los resultados tengan valores ingresados
|
||||
empty_results = self.result_ids.filtered(
|
||||
lambda r: not r.value_text and not r.value_numeric and not r.value_boolean and r.parameter_id.value_type != 'boolean'
|
||||
lambda r: not r.value_text and not r.value_numeric and not r.value_selection and not r.value_boolean and r.parameter_id.value_type != 'boolean'
|
||||
)
|
||||
if empty_results:
|
||||
params = ', '.join(empty_results.mapped('parameter_id.name'))
|
||||
|
|
68
test/debug_selection_autocomplete.py
Normal file
68
test/debug_selection_autocomplete.py
Normal file
|
@ -0,0 +1,68 @@
|
|||
#!/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)
|
Loading…
Reference in New Issue
Block a user