Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
3996 Представления
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!")


Аватар
Отменить
Автор Лучший ответ

@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:

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
июн. 19
3289
0
июн. 20
3991
1
мая 19
3652
2
июл. 24
14127
1
июл. 21
8324