콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
4150 화면
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:

아바타
취소
관련 게시물 답글 화면 활동
1
6월 19
3410
0
6월 20
4135
1
5월 19
3809
2
7월 24
14373
1
7월 21
8608