In a dating system I need the doctor to not have an appointment on the same day and at the same time. This is my code but it does not work! @ api.constrains ('fconsulta', 'hconsulta', 'cdoctores') def _citaunica (self): for record in self: if record.hconsulta in self and record.fconsulta in self and record.cdoctores in self: raise exceptions.UserError ("The date must be later than today!")
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
@Zbik dont work!
You have given too little data to help us get a good answer. For example what is the fields definition?
oh sorry, this
_name = 'centromedico.citas'
fconsulta = fields.Date(string="Fecha consulta", required=True)
hconsulta = fields.Float(string="Hora consulta", required=True)
cpaciente = fields.Many2one('centromedico.pacientes', string="Paciente", ondelete="cascade")
cdoctores = fields.Many2one('centromedico.medicos', string="Doctor/a", ondelete="cascade")
chistorial = fields.Many2one('centromedico.historialclinico', string="Historial", ondelete="cascade")
Try this:
if record.hconsulta and record.fconsulta and record.cdoctores:
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
1
jun 19
|
3257 | ||
|
0
jun 20
|
3961 | ||
|
1
may 19
|
3635 | ||
|
2
jul 24
|
14098 | ||
|
1
jul 21
|
8290 |