Fix IA (max_tokens del modelo de razonamiento + fallback al gateway), sidebar con toggle arriba, busqueda de un solo campo (paciente/global), editar expediente, marketing en visitas, responsive de agenda; doc de diagnostico WhatsApp
This commit is contained in:
@@ -34,6 +34,22 @@ def _parse_json_body():
|
||||
return {}
|
||||
|
||||
|
||||
def _patient_search_domain(search):
|
||||
"""Dominio de búsqueda de pacientes por texto libre.
|
||||
|
||||
Se parte la consulta en tokens y cada token debe aparecer en nombre,
|
||||
teléfono o email (AND implícito entre grupos OR). Así "juan arevalo"
|
||||
encuentra a "AREVALO LEAL JUAN ENRIQUE" sin importar el orden ni que el
|
||||
nombre esté capturado con apellidos primero. ilike de Odoo aplica
|
||||
unaccent, por lo que acentos y mayúsculas son indistintos.
|
||||
"""
|
||||
tokens = [t for t in re.split(r'[\s,]+', search or '') if t]
|
||||
domain = []
|
||||
for t in tokens:
|
||||
domain += ['|', '|', ('name', 'ilike', t), ('phone', 'ilike', t), ('email', 'ilike', t)]
|
||||
return domain
|
||||
|
||||
|
||||
class SkeenFrontendController(http.Controller):
|
||||
"""Controladores API públicos para el Frontend React de SKEEN"""
|
||||
|
||||
@@ -1345,8 +1361,7 @@ class SkeenFrontendController(http.Controller):
|
||||
try:
|
||||
domain = [('is_patient', '=', True)]
|
||||
if kw.get('search'):
|
||||
search = kw.get('search')
|
||||
domain += ['|', '|', ('name', 'ilike', search), ('phone', 'ilike', search), ('email', 'ilike', search)]
|
||||
domain += _patient_search_domain(kw.get('search'))
|
||||
if kw.get('incomplete') == '1':
|
||||
domain += [('expediente_completion', '<', 100)]
|
||||
if kw.get('vip') == '1':
|
||||
@@ -1390,8 +1405,7 @@ class SkeenFrontendController(http.Controller):
|
||||
try:
|
||||
domain = [('is_patient', '=', True)]
|
||||
if kw.get('search'):
|
||||
search = kw['search']
|
||||
domain += ['|', '|', ('name', 'ilike', search), ('phone', 'ilike', search), ('email', 'ilike', search)]
|
||||
domain += _patient_search_domain(kw['search'])
|
||||
if kw.get('incomplete') == '1':
|
||||
domain += [('expediente_completion', '<', 100)]
|
||||
if kw.get('vip') == '1':
|
||||
@@ -2435,8 +2449,7 @@ class SkeenFrontendController(http.Controller):
|
||||
return json_response({'status': 'success', 'patients': [], 'appointments': [], 'services': []})
|
||||
Partner = request.env['res.partner'].sudo()
|
||||
patients = Partner.search(
|
||||
[('is_patient', '=', True), '|', '|',
|
||||
('name', 'ilike', q), ('phone', 'ilike', q), ('email', 'ilike', q)],
|
||||
[('is_patient', '=', True)] + _patient_search_domain(q),
|
||||
limit=5, order='name asc')
|
||||
Citas = request.env['skeen.cita'].sudo()
|
||||
citas = Citas.search(
|
||||
|
||||
Reference in New Issue
Block a user