Staff: campo tipo Doctor/Cosmetologa, filtro por tipo en agenda y selector editable en modulo Medicos
This commit is contained in:
@@ -11,3 +11,10 @@ class HrEmployee(models.Model):
|
||||
default=0.0,
|
||||
help='Porcentaje de comisión sobre la venta de artículos recetados por este médico.',
|
||||
)
|
||||
|
||||
staff_type = fields.Selection(
|
||||
[('doctor', 'Doctor'), ('cosmetologa', 'Cosmetóloga')],
|
||||
string='Tipo de Staff',
|
||||
default='doctor',
|
||||
help='Tipo de personal de la agenda: Doctor o Cosmetóloga.',
|
||||
)
|
||||
|
||||
@@ -1909,6 +1909,7 @@ class SkeenFrontendController(http.Controller):
|
||||
'work_phone': d.work_phone or '',
|
||||
'work_email': d.work_email or '',
|
||||
'commission_pct': 0.0 if hide_money else (d.commission_pct or 0.0),
|
||||
'staff_type': d.staff_type or 'doctor',
|
||||
'patient_count': counts.get(d.id, 0),
|
||||
'recomendaciones_30d': recomendaciones.get(d.id, 0),
|
||||
'ventas_30d': 0 if hide_money else len(stats.get(d.id, {}).get('ventas', set())),
|
||||
@@ -1931,6 +1932,10 @@ class SkeenFrontendController(http.Controller):
|
||||
vals = {}
|
||||
if 'commission_pct' in data:
|
||||
vals['commission_pct'] = float(data.get('commission_pct') or 0)
|
||||
if 'staff_type' in data:
|
||||
if data['staff_type'] not in ('doctor', 'cosmetologa'):
|
||||
return json_response({'status': 'error', 'message': "staff_type debe ser 'doctor' o 'cosmetologa'"}, 400)
|
||||
vals['staff_type'] = data['staff_type']
|
||||
if vals:
|
||||
doctor.write(vals)
|
||||
return json_response({
|
||||
@@ -1939,6 +1944,7 @@ class SkeenFrontendController(http.Controller):
|
||||
'id': doctor.id, 'name': doctor.name, 'job_title': doctor.job_title or '',
|
||||
'work_phone': doctor.work_phone or '', 'work_email': doctor.work_email or '',
|
||||
'commission_pct': doctor.commission_pct or 0.0,
|
||||
'staff_type': doctor.staff_type or 'doctor',
|
||||
},
|
||||
})
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user